From 3c29734862930479dd1fd691649e694a94bbea52 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 21 Jul 2005 10:14:36 +0000 Subject: [PATCH 1/1] position of wxEVT_MOUSEWHEEL events is now in client, not screen, coordinates git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34897 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + src/msw/window.cpp | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 68b8f1f0af..aabf5952d1 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -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: diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 80c338d8df..8063d16afc 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -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; -- 2.45.2