path: root/src/plugins/platforms/winrt/qwinrtscreen.cpp
diff options
authorOliver Wolff <>2018-02-01 09:05:24 +0100
committerOliver Wolff <>2018-02-12 07:39:56 +0000
commit675603a853d7159592b1e120be15309ebceda4ad (patch)
treef3e1d7e41251fbe62c4ba2115c804616b88b30a9 /src/plugins/platforms/winrt/qwinrtscreen.cpp
parent9d293e24a0a196a1da5eb32bc3db805c4f14a09d (diff)
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 <>
Diffstat (limited to 'src/plugins/platforms/winrt/qwinrtscreen.cpp')
1 files changed, 3 insertions, 2 deletions
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 @@
#include "qwinrtwindow.h"
#include <private/qeventdispatcher_winrt_p.h>
+#include <private/qhighdpiscaling_p.h>
#include <QtCore/QLoggingCategory>
#include <QtGui/QSurfaceFormat>
@@ -1126,11 +1127,11 @@ HRESULT QWinRTScreen::onPointerUpdated(ICoreWindow *, IPointerEventArgs *args)
// Common traits - point, modifiers, properties
Point 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)