summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowspointerhandler.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2023-11-06 14:44:28 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2023-11-09 15:59:41 +0100
commit78512135c83b92944a0d897d4f387c8e358160bb (patch)
tree888ee60e94b500aa8392968da38fff38e84c2aa9 /src/plugins/platforms/windows/qwindowspointerhandler.cpp
parentc93ab8c2a015b40b9a487ed9f23a72aebea8d52a (diff)
Windows QPA: Fix wheel events when using -platform windows:reverse
Wheel events in WM_POINTER messages use global coordinates. Move the code doing the RTL correction into the local coordinates branch. Fixes: QTBUG-117499 Task-number: QTBUG-28463 Pick-to: 6.6 6.5 Change-Id: I10e965da9e9660985eaa2681fcf780b5388299a2 Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Timothée Keller <timothee.keller@qt.io>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowspointerhandler.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowspointerhandler.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/plugins/platforms/windows/qwindowspointerhandler.cpp b/src/plugins/platforms/windows/qwindowspointerhandler.cpp
index f4e88c117e1..9f1f25db8c2 100644
--- a/src/plugins/platforms/windows/qwindowspointerhandler.cpp
+++ b/src/plugins/platforms/windows/qwindowspointerhandler.cpp
@@ -742,20 +742,20 @@ bool QWindowsPointerHandler::translateMouseEvent(QWindow *window,
{
*result = 0;
- QPoint eventPos(GET_X_LPARAM(msg.lParam), GET_Y_LPARAM(msg.lParam));
- if ((et & QtWindows::NonClientEventFlag) == 0 && QWindowsBaseWindow::isRtlLayout(hwnd)) {
- RECT clientArea;
- GetClientRect(hwnd, &clientArea);
- eventPos.setX(clientArea.right - eventPos.x());
- }
-
QPoint localPos;
QPoint globalPos;
+ QPoint eventPos(GET_X_LPARAM(msg.lParam), GET_Y_LPARAM(msg.lParam));
if ((et == QtWindows::MouseWheelEvent) || (et & QtWindows::NonClientEventFlag)) {
globalPos = eventPos;
localPos = QWindowsGeometryHint::mapFromGlobal(hwnd, eventPos);
} else {
+ if (QWindowsBaseWindow::isRtlLayout(hwnd)) {
+ RECT clientArea;
+ GetClientRect(hwnd, &clientArea);
+ eventPos.setX(clientArea.right - eventPos.x());
+ }
+
globalPos = QWindowsGeometryHint::mapToGlobal(hwnd, eventPos);
auto targetHwnd = hwnd;
if (auto *pw = window->handle())