1181 WIN_MSG(WM_CTLCOLORMSGBOX)
1182 WIN_MSG(WM_CTLCOLOREDIT)
1183 WIN_MSG(WM_CTLCOLORLISTBOX)
1184 WIN_MSG(WM_CTLCOLORBTN)
1185 WIN_MSG(WM_CTLCOLORDLG)
1186 WIN_MSG(WM_CTLCOLORSCROLLBAR)
1187 WIN_MSG(WM_CTLCOLORSTATIC)
1188 WIN_MSG(WM_MOUSEMOVE)
1189 WIN_MSG(WM_LBUTTONDOWN)
1190 WIN_MSG(WM_LBUTTONUP)
1191 WIN_MSG(WM_LBUTTONDBLCLK)
1192 WIN_MSG(WM_RBUTTONDOWN)
1193 WIN_MSG(WM_RBUTTONUP)
1194 WIN_MSG(WM_RBUTTONDBLCLK)
1195 WIN_MSG(WM_MBUTTONDOWN)
1196 WIN_MSG(WM_MBUTTONUP)
1197 WIN_MSG(WM_MBUTTONDBLCLK)
1198 WIN_MSG(WM_XBUTTONDBLCLK)
1199 WIN_MSG(WM_XBUTTONDOWN)
1200 WIN_MSG(WM_XBUTTONUP)
1201 WIN_MSG(WM_MOUSEWHEEL)
1202 WIN_MSG(WM_PARENTNOTIFY)
1203 WIN_MSG(WM_ENTERMENULOOP)
1204 WIN_MSG(WM_EXITMENULOOP)
1205 WIN_MSG(WM_NEXTMENU)
1206 WIN_MSG(WM_SIZING)
1207 WIN_MSG(WM_CAPTURECHANGED)
1208 WIN_MSG(WM_MOVING)
1209 WIN_MSG(WM_POWERBROADCAST)
1210 WIN_MSG(WM_DEVICECHANGE)
1211 WIN_MSG(WM_MDICREATE)
1212 WIN_MSG(WM_MDIDESTROY)
1213 WIN_MSG(WM_MDIACTIVATE)
1214 WIN_MSG(WM_MDIRESTORE)
1215 WIN_MSG(WM_MDINEXT)
1216 WIN_MSG(WM_MDIMAXIMIZE)
1217 WIN_MSG(WM_MDITILE)
1218 WIN_MSG(WM_MDICASCADE)
1219 WIN_MSG(WM_MDIICONARRANGE)
1220 WIN_MSG(WM_MDIGETACTIVE)
1612 case WM_LBUTTONUP:
1613 if (ignoreNextLBTNUP) {
1614 ignoreNextLBTNUP = FALSE;
1615 return mrDoDefault;
1616 }
1617 //fall-through
1618 case WM_LBUTTONDOWN:
1619 ignoreNextLBTNUP = FALSE;
1620 //fall-through
1621 case WM_LBUTTONDBLCLK:
1622 case WM_RBUTTONDOWN:
1623 case WM_RBUTTONDBLCLK:
1624 case WM_RBUTTONUP:
1625 case WM_MBUTTONDOWN:
1626 case WM_MBUTTONDBLCLK:
1627 case WM_MBUTTONUP:
1628 case WM_XBUTTONDBLCLK:
1629 case WM_XBUTTONDOWN:
1630 case WM_XBUTTONUP:
1631 case WM_MOUSEMOVE:
1632 case WM_MOUSEWHEEL:
1633 case WM_AWT_MOUSEENTER:
1634 case WM_AWT_MOUSEEXIT:
1635 curPos = ::GetMessagePos();
1636 POINT myPos;
1637 myPos.x = GET_X_LPARAM(curPos);
1638 myPos.y = GET_Y_LPARAM(curPos);
1639 ::ScreenToClient(GetHWnd(), &myPos);
1640 switch(switchMessage) {
1641 case WM_AWT_MOUSEENTER:
1642 mr = WmMouseEnter(static_cast<UINT>(wParam), myPos.x, myPos.y);
1643 break;
1644 case WM_LBUTTONDOWN:
1645 case WM_LBUTTONDBLCLK:
1646 mr = WmMouseDown(static_cast<UINT>(wParam), myPos.x, myPos.y,
1647 LEFT_BUTTON);
1648 break;
1649 case WM_LBUTTONUP:
1650 mr = WmMouseUp(static_cast<UINT>(wParam), myPos.x, myPos.y,
1651 LEFT_BUTTON);
1652 break;
1653 case WM_MOUSEMOVE:
1654 mr = WmMouseMove(static_cast<UINT>(wParam), myPos.x, myPos.y);
1655 break;
1656 case WM_MBUTTONDOWN:
1657 case WM_MBUTTONDBLCLK:
1658 mr = WmMouseDown(static_cast<UINT>(wParam), myPos.x, myPos.y,
1659 MIDDLE_BUTTON);
1682 X2_BUTTON);
1683 }
1684 }
1685 break;
1686 case WM_RBUTTONDOWN:
1687 case WM_RBUTTONDBLCLK:
1688 mr = WmMouseDown(static_cast<UINT>(wParam), myPos.x, myPos.y,
1689 RIGHT_BUTTON);
1690 break;
1691 case WM_RBUTTONUP:
1692 mr = WmMouseUp(static_cast<UINT>(wParam), myPos.x, myPos.y,
1693 RIGHT_BUTTON);
1694 break;
1695 case WM_MBUTTONUP:
1696 mr = WmMouseUp(static_cast<UINT>(wParam), myPos.x, myPos.y,
1697 MIDDLE_BUTTON);
1698 break;
1699 case WM_AWT_MOUSEEXIT:
1700 mr = WmMouseExit(static_cast<UINT>(wParam), myPos.x, myPos.y);
1701 break;
1702 case WM_MOUSEWHEEL:
1703 mr = WmMouseWheel(GET_KEYSTATE_WPARAM(wParam),
1704 GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam),
1705 GET_WHEEL_DELTA_WPARAM(wParam));
1706 break;
1707 }
1708 break;
1709 case WM_SETCURSOR:
1710 mr = mrDoDefault;
1711 if (LOWORD(lParam) == HTCLIENT) {
1712 if (AwtComponent* comp =
1713 AwtComponent::GetComponent((HWND)wParam)) {
1714 AwtCursor::UpdateCursor(comp);
1715 mr = mrConsume;
1716 }
1717 }
1718 break;
1719
1720 case WM_KEYDOWN:
1721 mr = WmKeyDown(static_cast<UINT>(wParam),
1722 LOWORD(lParam), HIWORD(lParam), FALSE);
1723 break;
1724 case WM_KEYUP:
1725 mr = WmKeyUp(static_cast<UINT>(wParam),
2432 MSG msg;
2433 InitMessage(&msg, lastMessage, flags, MAKELPARAM(x, y), x, y);
2434 SendMouseEvent(java_awt_event_MouseEvent_MOUSE_MOVED, ::JVM_CurrentTimeMillis(NULL, 0), x, y,
2435 GetJavaModifiers(), 0, JNI_FALSE,
2436 java_awt_event_MouseEvent_NOBUTTON, &msg);
2437 }
2438 }
2439
2440 return mrConsume;
2441 }
2442
2443 MsgRouting AwtComponent::WmMouseExit(UINT flags, int x, int y)
2444 {
2445 SendMouseEvent(java_awt_event_MouseEvent_MOUSE_EXITED, ::JVM_CurrentTimeMillis(NULL, 0), x,
2446 y, GetJavaModifiers(), 0, JNI_FALSE);
2447 sm_cursorOn = NULL;
2448 return mrConsume; /* Don't pass our synthetic event on! */
2449 }
2450
2451 MsgRouting AwtComponent::WmMouseWheel(UINT flags, int x, int y,
2452 int wheelRotation)
2453 {
2454 // convert coordinates to be Component-relative, not screen relative
2455 // for wheeling when outside the window, this works similar to
2456 // coordinates during a drag
2457 POINT eventPt;
2458 eventPt.x = x;
2459 eventPt.y = y;
2460 DTRACE_PRINT2(" original coords: %i,%i\n", x, y);
2461 ::ScreenToClient(GetHWnd(), &eventPt);
2462 DTRACE_PRINT2(" new coords: %i,%i\n\n", eventPt.x, eventPt.y);
2463
2464 // set some defaults
2465 jint scrollType = java_awt_event_MouseWheelEvent_WHEEL_UNIT_SCROLL;
2466 jint scrollLines = 3;
2467
2468 BOOL result;
2469 UINT platformLines;
2470
2471 m_wheelRotationAmount += wheelRotation;
2472
2477
2478 MSG msg;
2479 result = ::SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0,
2480 &platformLines, 0);
2481 InitMessage(&msg, lastMessage, MAKEWPARAM(flags, wheelRotation),
2482 MAKELPARAM(x, y));
2483
2484 if (result) {
2485 if (platformLines == WHEEL_PAGESCROLL) {
2486 scrollType = java_awt_event_MouseWheelEvent_WHEEL_BLOCK_SCROLL;
2487 scrollLines = 1;
2488 }
2489 else {
2490 scrollType = java_awt_event_MouseWheelEvent_WHEEL_UNIT_SCROLL;
2491 scrollLines = platformLines;
2492 }
2493 }
2494
2495 DTRACE_PRINTLN("calling SendMouseWheelEvent");
2496
2497 SendMouseWheelEvent(java_awt_event_MouseEvent_MOUSE_WHEEL, ::JVM_CurrentTimeMillis(NULL, 0),
2498 eventPt.x, eventPt.y, GetJavaModifiers(), 0, 0, scrollType,
2499 scrollLines, roundedWheelRotation, preciseWheelRotation, &msg);
2500
2501 m_wheelRotationAmount %= WHEEL_DELTA;
2502 // this message could be propagated up to the parent chain
2503 // by the mouse message post processors
2504 return mrConsume;
2505 }
2506
2507 jint AwtComponent::GetKeyLocation(UINT wkey, UINT flags) {
2508 // Rector+Newcomer page 413
2509 // The extended keys are the Alt and Control on the right of
2510 // the space bar, the non-Numpad arrow keys, the non-Numpad
2511 // Insert, PageUp, etc. keys, and the Numpad Divide and Enter keys.
2512 // Note that neither Shift key is extended.
2513 // Although not listed in Rector+Newcomer, both Windows keys
2514 // (91 and 92) are extended keys, the Context Menu key
2515 // (property key or application key - 93) is extended,
2516 // and so is the NumLock key.
2517
2518 // wkey is the wParam, flags is the HIWORD of the lParam
|
1181 WIN_MSG(WM_CTLCOLORMSGBOX)
1182 WIN_MSG(WM_CTLCOLOREDIT)
1183 WIN_MSG(WM_CTLCOLORLISTBOX)
1184 WIN_MSG(WM_CTLCOLORBTN)
1185 WIN_MSG(WM_CTLCOLORDLG)
1186 WIN_MSG(WM_CTLCOLORSCROLLBAR)
1187 WIN_MSG(WM_CTLCOLORSTATIC)
1188 WIN_MSG(WM_MOUSEMOVE)
1189 WIN_MSG(WM_LBUTTONDOWN)
1190 WIN_MSG(WM_LBUTTONUP)
1191 WIN_MSG(WM_LBUTTONDBLCLK)
1192 WIN_MSG(WM_RBUTTONDOWN)
1193 WIN_MSG(WM_RBUTTONUP)
1194 WIN_MSG(WM_RBUTTONDBLCLK)
1195 WIN_MSG(WM_MBUTTONDOWN)
1196 WIN_MSG(WM_MBUTTONUP)
1197 WIN_MSG(WM_MBUTTONDBLCLK)
1198 WIN_MSG(WM_XBUTTONDBLCLK)
1199 WIN_MSG(WM_XBUTTONDOWN)
1200 WIN_MSG(WM_XBUTTONUP)
1201 WIN_MSG(WM_MOUSEHWHEEL)
1202 WIN_MSG(WM_MOUSEWHEEL)
1203 WIN_MSG(WM_PARENTNOTIFY)
1204 WIN_MSG(WM_ENTERMENULOOP)
1205 WIN_MSG(WM_EXITMENULOOP)
1206 WIN_MSG(WM_NEXTMENU)
1207 WIN_MSG(WM_SIZING)
1208 WIN_MSG(WM_CAPTURECHANGED)
1209 WIN_MSG(WM_MOVING)
1210 WIN_MSG(WM_POWERBROADCAST)
1211 WIN_MSG(WM_DEVICECHANGE)
1212 WIN_MSG(WM_MDICREATE)
1213 WIN_MSG(WM_MDIDESTROY)
1214 WIN_MSG(WM_MDIACTIVATE)
1215 WIN_MSG(WM_MDIRESTORE)
1216 WIN_MSG(WM_MDINEXT)
1217 WIN_MSG(WM_MDIMAXIMIZE)
1218 WIN_MSG(WM_MDITILE)
1219 WIN_MSG(WM_MDICASCADE)
1220 WIN_MSG(WM_MDIICONARRANGE)
1221 WIN_MSG(WM_MDIGETACTIVE)
1613 case WM_LBUTTONUP:
1614 if (ignoreNextLBTNUP) {
1615 ignoreNextLBTNUP = FALSE;
1616 return mrDoDefault;
1617 }
1618 //fall-through
1619 case WM_LBUTTONDOWN:
1620 ignoreNextLBTNUP = FALSE;
1621 //fall-through
1622 case WM_LBUTTONDBLCLK:
1623 case WM_RBUTTONDOWN:
1624 case WM_RBUTTONDBLCLK:
1625 case WM_RBUTTONUP:
1626 case WM_MBUTTONDOWN:
1627 case WM_MBUTTONDBLCLK:
1628 case WM_MBUTTONUP:
1629 case WM_XBUTTONDBLCLK:
1630 case WM_XBUTTONDOWN:
1631 case WM_XBUTTONUP:
1632 case WM_MOUSEMOVE:
1633 case WM_MOUSEHWHEEL:
1634 case WM_MOUSEWHEEL:
1635 case WM_AWT_MOUSEENTER:
1636 case WM_AWT_MOUSEEXIT:
1637 curPos = ::GetMessagePos();
1638 POINT myPos;
1639 myPos.x = GET_X_LPARAM(curPos);
1640 myPos.y = GET_Y_LPARAM(curPos);
1641 ::ScreenToClient(GetHWnd(), &myPos);
1642 BOOL hMouseWheel;
1643 hMouseWheel = FALSE;
1644 switch(switchMessage) {
1645 case WM_AWT_MOUSEENTER:
1646 mr = WmMouseEnter(static_cast<UINT>(wParam), myPos.x, myPos.y);
1647 break;
1648 case WM_LBUTTONDOWN:
1649 case WM_LBUTTONDBLCLK:
1650 mr = WmMouseDown(static_cast<UINT>(wParam), myPos.x, myPos.y,
1651 LEFT_BUTTON);
1652 break;
1653 case WM_LBUTTONUP:
1654 mr = WmMouseUp(static_cast<UINT>(wParam), myPos.x, myPos.y,
1655 LEFT_BUTTON);
1656 break;
1657 case WM_MOUSEMOVE:
1658 mr = WmMouseMove(static_cast<UINT>(wParam), myPos.x, myPos.y);
1659 break;
1660 case WM_MBUTTONDOWN:
1661 case WM_MBUTTONDBLCLK:
1662 mr = WmMouseDown(static_cast<UINT>(wParam), myPos.x, myPos.y,
1663 MIDDLE_BUTTON);
1686 X2_BUTTON);
1687 }
1688 }
1689 break;
1690 case WM_RBUTTONDOWN:
1691 case WM_RBUTTONDBLCLK:
1692 mr = WmMouseDown(static_cast<UINT>(wParam), myPos.x, myPos.y,
1693 RIGHT_BUTTON);
1694 break;
1695 case WM_RBUTTONUP:
1696 mr = WmMouseUp(static_cast<UINT>(wParam), myPos.x, myPos.y,
1697 RIGHT_BUTTON);
1698 break;
1699 case WM_MBUTTONUP:
1700 mr = WmMouseUp(static_cast<UINT>(wParam), myPos.x, myPos.y,
1701 MIDDLE_BUTTON);
1702 break;
1703 case WM_AWT_MOUSEEXIT:
1704 mr = WmMouseExit(static_cast<UINT>(wParam), myPos.x, myPos.y);
1705 break;
1706 case WM_MOUSEHWHEEL:
1707 hMouseWheel = TRUE;
1708 case WM_MOUSEWHEEL:
1709 mr = WmMouseWheel(GET_KEYSTATE_WPARAM(wParam),
1710 GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam),
1711 GET_WHEEL_DELTA_WPARAM(wParam), hMouseWheel);
1712 break;
1713 }
1714 break;
1715 case WM_SETCURSOR:
1716 mr = mrDoDefault;
1717 if (LOWORD(lParam) == HTCLIENT) {
1718 if (AwtComponent* comp =
1719 AwtComponent::GetComponent((HWND)wParam)) {
1720 AwtCursor::UpdateCursor(comp);
1721 mr = mrConsume;
1722 }
1723 }
1724 break;
1725
1726 case WM_KEYDOWN:
1727 mr = WmKeyDown(static_cast<UINT>(wParam),
1728 LOWORD(lParam), HIWORD(lParam), FALSE);
1729 break;
1730 case WM_KEYUP:
1731 mr = WmKeyUp(static_cast<UINT>(wParam),
2438 MSG msg;
2439 InitMessage(&msg, lastMessage, flags, MAKELPARAM(x, y), x, y);
2440 SendMouseEvent(java_awt_event_MouseEvent_MOUSE_MOVED, ::JVM_CurrentTimeMillis(NULL, 0), x, y,
2441 GetJavaModifiers(), 0, JNI_FALSE,
2442 java_awt_event_MouseEvent_NOBUTTON, &msg);
2443 }
2444 }
2445
2446 return mrConsume;
2447 }
2448
2449 MsgRouting AwtComponent::WmMouseExit(UINT flags, int x, int y)
2450 {
2451 SendMouseEvent(java_awt_event_MouseEvent_MOUSE_EXITED, ::JVM_CurrentTimeMillis(NULL, 0), x,
2452 y, GetJavaModifiers(), 0, JNI_FALSE);
2453 sm_cursorOn = NULL;
2454 return mrConsume; /* Don't pass our synthetic event on! */
2455 }
2456
2457 MsgRouting AwtComponent::WmMouseWheel(UINT flags, int x, int y,
2458 int wheelRotation, BOOL hMouseWheel)
2459 {
2460 // convert coordinates to be Component-relative, not screen relative
2461 // for wheeling when outside the window, this works similar to
2462 // coordinates during a drag
2463 POINT eventPt;
2464 eventPt.x = x;
2465 eventPt.y = y;
2466 DTRACE_PRINT2(" original coords: %i,%i\n", x, y);
2467 ::ScreenToClient(GetHWnd(), &eventPt);
2468 DTRACE_PRINT2(" new coords: %i,%i\n\n", eventPt.x, eventPt.y);
2469
2470 // set some defaults
2471 jint scrollType = java_awt_event_MouseWheelEvent_WHEEL_UNIT_SCROLL;
2472 jint scrollLines = 3;
2473
2474 BOOL result;
2475 UINT platformLines;
2476
2477 m_wheelRotationAmount += wheelRotation;
2478
2483
2484 MSG msg;
2485 result = ::SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0,
2486 &platformLines, 0);
2487 InitMessage(&msg, lastMessage, MAKEWPARAM(flags, wheelRotation),
2488 MAKELPARAM(x, y));
2489
2490 if (result) {
2491 if (platformLines == WHEEL_PAGESCROLL) {
2492 scrollType = java_awt_event_MouseWheelEvent_WHEEL_BLOCK_SCROLL;
2493 scrollLines = 1;
2494 }
2495 else {
2496 scrollType = java_awt_event_MouseWheelEvent_WHEEL_UNIT_SCROLL;
2497 scrollLines = platformLines;
2498 }
2499 }
2500
2501 DTRACE_PRINTLN("calling SendMouseWheelEvent");
2502
2503 jint modifiers = GetJavaModifiers();
2504 if (hMouseWheel) {
2505 modifiers |= java_awt_event_InputEvent_SHIFT_DOWN_MASK;
2506 }
2507 SendMouseWheelEvent(java_awt_event_MouseEvent_MOUSE_WHEEL, ::JVM_CurrentTimeMillis(NULL, 0),
2508 eventPt.x, eventPt.y, modifiers, 0, 0, scrollType,
2509 scrollLines, roundedWheelRotation, preciseWheelRotation, &msg);
2510
2511 m_wheelRotationAmount %= WHEEL_DELTA;
2512 // this message could be propagated up to the parent chain
2513 // by the mouse message post processors
2514 return mrConsume;
2515 }
2516
2517 jint AwtComponent::GetKeyLocation(UINT wkey, UINT flags) {
2518 // Rector+Newcomer page 413
2519 // The extended keys are the Alt and Control on the right of
2520 // the space bar, the non-Numpad arrow keys, the non-Numpad
2521 // Insert, PageUp, etc. keys, and the Numpad Divide and Enter keys.
2522 // Note that neither Shift key is extended.
2523 // Although not listed in Rector+Newcomer, both Windows keys
2524 // (91 and 92) are extended keys, the Context Menu key
2525 // (property key or application key - 93) is extended,
2526 // and so is the NumLock key.
2527
2528 // wkey is the wParam, flags is the HIWORD of the lParam
|