From 8abbb6ec725c41e08db8421f3e10b15b66ba28b1 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 2 Mar 2018 14:59:57 +0100 Subject: Windows QPA: Fix scaling of tablet coordinates for High DPI scaling Determine the virtual desktop geometry in native pixels from the QPlatformScreen siblings. Use the platform window to determine the local position. Task-number: QTBUG-36937 Change-Id: Ic250f1b41d8e74099558796112dbd70a7e1f6956 Reviewed-by: Shawn Rutledge --- src/plugins/platforms/windows/qwindowstabletsupport.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforms/windows/qwindowstabletsupport.cpp') diff --git a/src/plugins/platforms/windows/qwindowstabletsupport.cpp b/src/plugins/platforms/windows/qwindowstabletsupport.cpp index 5fdc664603..78e33e57ab 100644 --- a/src/plugins/platforms/windows/qwindowstabletsupport.cpp +++ b/src/plugins/platforms/windows/qwindowstabletsupport.cpp @@ -421,7 +421,8 @@ bool QWindowsTabletSupport::translateTabletPacketEvent() // in which case we snap the position to the mouse position. // It seems there is no way to find out the mode programmatically, the LOGCONTEXT orgX/Y/Ext // area is always the virtual desktop. - const QRect virtualDesktopArea = QGuiApplication::primaryScreen()->virtualGeometry(); + const QRect virtualDesktopArea = + QWindowsScreen::virtualGeometry(QGuiApplication::primaryScreen()->handle()); qCDebug(lcQpaTablet) << __FUNCTION__ << "processing " << packetCount << "target:" << QGuiApplicationPrivate::tabletDevicePoint(uniqueId).target; @@ -455,7 +456,9 @@ bool QWindowsTabletSupport::translateTabletPacketEvent() if (!target) continue; - const QPoint localPos = target->mapFromGlobal(globalPos); + const QPlatformWindow *platformWindow = target->handle(); + Q_ASSERT(platformWindow); + const QPoint localPos = platformWindow->mapFromGlobal(globalPos); const qreal pressureNew = packet.pkButtons && (currentPointer == QTabletEvent::Pen || currentPointer == QTabletEvent::Eraser) ? m_devices.at(m_currentDevice).scalePressure(packet.pkNormalPressure) : -- cgit v1.2.3