< prev index next >
src/java.desktop/windows/native/libawt/windows/awt_Component.cpp
Print this page
*** 249,259 ****
m_bSubclassed = FALSE;
m_bPauseDestroy = FALSE;
m_MessagesProcessing = 0;
! m_wheelRotationAmount = 0;
if (!sm_PrimaryDynamicTableBuilt) {
// do it once.
AwtComponent::BuildPrimaryDynamicTable();
sm_PrimaryDynamicTableBuilt = TRUE;
}
--- 249,260 ----
m_bSubclassed = FALSE;
m_bPauseDestroy = FALSE;
m_MessagesProcessing = 0;
! m_wheelRotationAmountX = 0;
! m_wheelRotationAmountY = 0;
if (!sm_PrimaryDynamicTableBuilt) {
// do it once.
AwtComponent::BuildPrimaryDynamicTable();
sm_PrimaryDynamicTableBuilt = TRUE;
}
*** 1206,1215 ****
--- 1207,1217 ----
WIN_MSG(WM_MBUTTONDBLCLK)
WIN_MSG(WM_XBUTTONDBLCLK)
WIN_MSG(WM_XBUTTONDOWN)
WIN_MSG(WM_XBUTTONUP)
WIN_MSG(WM_MOUSEWHEEL)
+ WIN_MSG(WM_MOUSEHWHEEL)
WIN_MSG(WM_PARENTNOTIFY)
WIN_MSG(WM_ENTERMENULOOP)
WIN_MSG(WM_EXITMENULOOP)
WIN_MSG(WM_NEXTMENU)
WIN_MSG(WM_SIZING)
*** 1637,1646 ****
--- 1639,1649 ----
case WM_XBUTTONDBLCLK:
case WM_XBUTTONDOWN:
case WM_XBUTTONUP:
case WM_MOUSEMOVE:
case WM_MOUSEWHEEL:
+ case WM_MOUSEHWHEEL:
case WM_AWT_MOUSEENTER:
case WM_AWT_MOUSEEXIT:
curPos = ::GetMessagePos();
POINT myPos;
myPos.x = GET_X_LPARAM(curPos);
*** 1707,1719 ****
break;
case WM_AWT_MOUSEEXIT:
mr = WmMouseExit(static_cast<UINT>(wParam), myPos.x, myPos.y);
break;
case WM_MOUSEWHEEL:
mr = WmMouseWheel(GET_KEYSTATE_WPARAM(wParam),
GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam),
! GET_WHEEL_DELTA_WPARAM(wParam));
break;
}
break;
case WM_SETCURSOR:
mr = mrDoDefault;
--- 1710,1724 ----
break;
case WM_AWT_MOUSEEXIT:
mr = WmMouseExit(static_cast<UINT>(wParam), myPos.x, myPos.y);
break;
case WM_MOUSEWHEEL:
+ case WM_MOUSEHWHEEL:
mr = WmMouseWheel(GET_KEYSTATE_WPARAM(wParam),
GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam),
! GET_WHEEL_DELTA_WPARAM(wParam),
! switchMessage == WM_MOUSEHWHEEL);
break;
}
break;
case WM_SETCURSOR:
mr = mrDoDefault;
*** 2076,2092 ****
return mrDoDefault;
}
MsgRouting AwtComponent::WmSetFocus(HWND hWndLostFocus)
{
! m_wheelRotationAmount = 0;
return mrDoDefault;
}
MsgRouting AwtComponent::WmKillFocus(HWND hWndGotFocus)
{
! m_wheelRotationAmount = 0;
return mrDoDefault;
}
MsgRouting AwtComponent::WmCtlColor(HDC hDC, HWND hCtrl,
UINT ctlColor, HBRUSH& retBrush)
--- 2081,2099 ----
return mrDoDefault;
}
MsgRouting AwtComponent::WmSetFocus(HWND hWndLostFocus)
{
! m_wheelRotationAmountX = 0;
! m_wheelRotationAmountY = 0;
return mrDoDefault;
}
MsgRouting AwtComponent::WmKillFocus(HWND hWndGotFocus)
{
! m_wheelRotationAmountX = 0;
! m_wheelRotationAmountY = 0;
return mrDoDefault;
}
MsgRouting AwtComponent::WmCtlColor(HDC hDC, HWND hCtrl,
UINT ctlColor, HBRUSH& retBrush)
*** 2459,2469 ****
sm_cursorOn = NULL;
return mrConsume; /* Don't pass our synthetic event on! */
}
MsgRouting AwtComponent::WmMouseWheel(UINT flags, int x, int y,
! int wheelRotation)
{
// convert coordinates to be Component-relative, not screen relative
// for wheeling when outside the window, this works similar to
// coordinates during a drag
POINT eventPt;
--- 2466,2476 ----
sm_cursorOn = NULL;
return mrConsume; /* Don't pass our synthetic event on! */
}
MsgRouting AwtComponent::WmMouseWheel(UINT flags, int x, int y,
! int wheelRotation, BOOL isHorizontal)
{
// convert coordinates to be Component-relative, not screen relative
// for wheeling when outside the window, this works similar to
// coordinates during a drag
POINT eventPt;
*** 2473,2518 ****
::ScreenToClient(GetHWnd(), &eventPt);
DTRACE_PRINT2(" new coords: %i,%i\n\n", eventPt.x, eventPt.y);
// set some defaults
jint scrollType = java_awt_event_MouseWheelEvent_WHEEL_UNIT_SCROLL;
! jint scrollLines = 3;
BOOL result;
! UINT platformLines;
!
! m_wheelRotationAmount += wheelRotation;
// AWT interprets wheel rotation differently than win32, so we need to
// decode wheel amount.
! jint roundedWheelRotation = m_wheelRotationAmount / (-1 * WHEEL_DELTA);
! jdouble preciseWheelRotation = (jdouble) wheelRotation / (-1 * WHEEL_DELTA);
MSG msg;
- result = ::SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0,
- &platformLines, 0);
InitMessage(&msg, lastMessage, MAKEWPARAM(flags, wheelRotation),
MAKELPARAM(x, y));
if (result) {
! if (platformLines == WHEEL_PAGESCROLL) {
scrollType = java_awt_event_MouseWheelEvent_WHEEL_BLOCK_SCROLL;
! scrollLines = 1;
}
else {
scrollType = java_awt_event_MouseWheelEvent_WHEEL_UNIT_SCROLL;
! scrollLines = platformLines;
}
}
DTRACE_PRINTLN("calling SendMouseWheelEvent");
SendMouseWheelEvent(java_awt_event_MouseEvent_MOUSE_WHEEL, ::JVM_CurrentTimeMillis(NULL, 0),
! eventPt.x, eventPt.y, GetJavaModifiers(), 0, 0, scrollType,
! scrollLines, roundedWheelRotation, preciseWheelRotation, &msg);
! m_wheelRotationAmount %= WHEEL_DELTA;
// this message could be propagated up to the parent chain
// by the mouse message post processors
return mrConsume;
}
--- 2480,2537 ----
::ScreenToClient(GetHWnd(), &eventPt);
DTRACE_PRINT2(" new coords: %i,%i\n\n", eventPt.x, eventPt.y);
// set some defaults
jint scrollType = java_awt_event_MouseWheelEvent_WHEEL_UNIT_SCROLL;
! jint toScroll = 3;
BOOL result;
! UINT platformUnits;
! jint roundedWheelRotation;
! jdouble preciseWheelRotation;
// AWT interprets wheel rotation differently than win32, so we need to
// decode wheel amount.
! jint modifiers = GetJavaModifiers();
! if (isHorizontal) {
! modifiers |= java_awt_event_InputEvent_SHIFT_DOWN_MASK;
! m_wheelRotationAmountX += wheelRotation;
! roundedWheelRotation = m_wheelRotationAmountX / (WHEEL_DELTA);
! preciseWheelRotation = (jdouble) wheelRotation / (WHEEL_DELTA);
! result = ::SystemParametersInfo(SPI_GETWHEELSCROLLCHARS, 0,
! &platformUnits, 0);
! } else {
! m_wheelRotationAmountY += wheelRotation;
! roundedWheelRotation = m_wheelRotationAmountY / (-1 * WHEEL_DELTA);
! preciseWheelRotation = (jdouble) wheelRotation / (-1 * WHEEL_DELTA);
! result = ::SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0,
! &platformUnits, 0);
! }
MSG msg;
InitMessage(&msg, lastMessage, MAKEWPARAM(flags, wheelRotation),
MAKELPARAM(x, y));
if (result) {
! if (platformUnits == WHEEL_PAGESCROLL) {
scrollType = java_awt_event_MouseWheelEvent_WHEEL_BLOCK_SCROLL;
! toScroll = 1;
}
else {
scrollType = java_awt_event_MouseWheelEvent_WHEEL_UNIT_SCROLL;
! toScroll = platformUnits;
}
}
DTRACE_PRINTLN("calling SendMouseWheelEvent");
SendMouseWheelEvent(java_awt_event_MouseEvent_MOUSE_WHEEL, ::JVM_CurrentTimeMillis(NULL, 0),
! eventPt.x, eventPt.y, modifiers, 0, 0, scrollType,
! toScroll, roundedWheelRotation, preciseWheelRotation, &msg);
! m_wheelRotationAmountX %= WHEEL_DELTA;
! m_wheelRotationAmountY %= WHEEL_DELTA;
// this message could be propagated up to the parent chain
// by the mouse message post processors
return mrConsume;
}
< prev index next >