From 675603a853d7159592b1e120be15309ebceda4ad Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Thu, 1 Feb 2018 09:05:24 +0100 Subject: winrt: mouse handling: Fix detection of affected window With the previous implementation the detection of the affected window (windowAt which uses QWindow::geometry) only worked for the upper left quarter of the window, when used on a High DPI screen. As QWindow does not use native positions, the mouse cursor's position has to be mapped before checking the window under the mouse. Change-Id: I1a30b9669ec3e4c573cf83aed57c20d65675ff16 Reviewed-by: Andre de la Rocha Reviewed-by: Maurice Kalinowski --- src/plugins/platforms/winrt/qwinrtscreen.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforms/winrt/qwinrtscreen.cpp') diff --git a/src/plugins/platforms/winrt/qwinrtscreen.cpp b/src/plugins/platforms/winrt/qwinrtscreen.cpp index 7b9502f9ab..1a5af22814 100644 --- a/src/plugins/platforms/winrt/qwinrtscreen.cpp +++ b/src/plugins/platforms/winrt/qwinrtscreen.cpp @@ -47,6 +47,7 @@ #endif #include "qwinrtwindow.h" #include +#include #include #include @@ -1126,11 +1127,11 @@ HRESULT QWinRTScreen::onPointerUpdated(ICoreWindow *, IPointerEventArgs *args) // Common traits - point, modifiers, properties Point point; pointerPoint->get_Position(&point); - QPointF pos(point.X * d->scaleFactor, point.Y * d->scaleFactor); + const QPointF pos(point.X * d->scaleFactor, point.Y * d->scaleFactor); QPointF localPos = pos; const QPoint posPoint = pos.toPoint(); - QWindow *windowUnderPointer = windowAt(posPoint); + QWindow *windowUnderPointer = windowAt(QHighDpiScaling::mapPositionFromNative(posPoint, this)); QWindow *targetWindow = windowUnderPointer; if (d->mouseGrabWindow) -- cgit v1.2.3