Skip to content

Commit

Permalink
Windows QPA: Fix wheel events when using -platform windows:reverse
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Joerg Bornemann <[email protected]>
Reviewed-by: Timothée Keller <[email protected]>
  • Loading branch information
FriedemannKleint committed Nov 9, 2023
1 parent c93ab8c commit 7851213
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/plugins/platforms/windows/qwindowspointerhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 7851213

Please sign in to comment.