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>
This commit is contained in:
Friedemann Kleint 2014-01-22 16:55:10 +01:00 committed by The Qt Project
parent 0d95f7c0be
commit b87106811e

View File

@ -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;