diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2014-01-22 16:55:10 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-24 11:31:19 +0100 |
commit | b87106811e8a087b8c4ee36cd9d7929b57808132 (patch) | |
tree | 47ad570c65c12bb899fef5dab039905ac05c27ae | |
parent | 0d95f7c0bebf31e17f34157334961c34a0e6ffd7 (diff) |
Windows: Reconstruct MSG-structure properly.
The MSG structure is supposed to contain screen coordinates of the mouse
position. Use GET_X/Y_LPARAM for mouse events and transform for
client coordinates. Use GetCursorPos() for other events.
Task-number: QTBUG-36337
Change-Id: I3ad4de20e1a460ee58f22645a4339a2444d129ed
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
-rw-r--r-- | src/plugins/platforms/windows/qwindowscontext.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index c0db4805df..8380aba13b 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -734,8 +734,20 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, msg.message = message; // time and pt fields ignored msg.wParam = wParam; msg.lParam = lParam; - msg.pt.x = GET_X_LPARAM(lParam); - msg.pt.y = GET_Y_LPARAM(lParam); + msg.pt.x = msg.pt.y = 0; + if (et != QtWindows::CursorEvent && (et & (QtWindows::MouseEventFlag | QtWindows::NonClientEventFlag))) { + msg.pt.x = GET_X_LPARAM(lParam); + msg.pt.y = GET_Y_LPARAM(lParam); + // For non-client-area messages, these are screen coordinates (as expected + // in the MSG structure), otherwise they are client coordinates. + if (!(et & QtWindows::NonClientEventFlag)) { + ClientToScreen(msg.hwnd, &msg.pt); + } + } else { +#ifndef Q_OS_WINCE + GetCursorPos(&msg.pt); +#endif + } // Run the native event filters. long filterResult = 0; |