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.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>
(cherry picked from commit 78512135c83b92944a0d897d4f387c8e358160bb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Friedemann Kleint 2023-11-06 14:44:28 +01:00 committed by Qt Cherry-pick Bot
parent b65e1141da
commit 6ac543c843

View File

@ -739,20 +739,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())