]> git.saurik.com Git - wxWidgets.git/commitdiff
position of wxEVT_MOUSEWHEEL events is now in client, not screen, coordinates
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 21 Jul 2005 10:14:36 +0000 (10:14 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 21 Jul 2005 10:14:36 +0000 (10:14 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34897 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
src/msw/window.cpp

index 68b8f1f0af6071cac882e527c0a713929c1c4f9c..aabf5952d19554cee6ffe6f864e2bd0a58195730 100644 (file)
@@ -22,6 +22,7 @@ wxMSW:
 - Fixed multiline tooltips handling.
 - Fixed wxSlider::GetSelEnd() (Atilim Cetin)
 - Fixed accelerators of menu items added to already attached submenus
+- Position of wxEVT_MOUSEWHEEL events is now in client, not screen, coordinates
 
 wxUniv:
 
index 80c338d8df22d565e56fd97f15a99c89eb87ac2f..8063d16afce0c1a718b21b50faa8936d830a69fb 100644 (file)
@@ -4575,11 +4575,14 @@ bool wxWindowMSW::HandleMouseMove(int x, int y, WXUINT flags)
 bool wxWindowMSW::HandleMouseWheel(WXWPARAM wParam, WXLPARAM lParam)
 {
 #if wxUSE_MOUSEWHEEL
+    // notice that WM_MOUSEWHEEL position is in screen coords (as it's
+    // forwarded up to the parent by DefWindowProc()) and not in the client
+    // ones as all the other messages, translate them to the client coords for
+    // consistency
+    const wxPoint
+        pt = ScreenToClient(wxPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)));
     wxMouseEvent event(wxEVT_MOUSEWHEEL);
-    InitMouseEvent(event,
-                   GET_X_LPARAM(lParam),
-                   GET_Y_LPARAM(lParam),
-                   LOWORD(wParam));
+    InitMouseEvent(event, pt.x, pt.y, LOWORD(wParam));
     event.m_wheelRotation = (short)HIWORD(wParam);
     event.m_wheelDelta = WHEEL_DELTA;