summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2020-12-04 10:28:26 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-12-08 08:05:19 +0000
commit054ef63eb9dd6af6bbf5767ed9930f1bfc3aa29f (patch)
tree98c9110748dd5bca3a1d6e2aa686773bbfc0af63 /src/plugins/platforms
parent46aae17ac1a4d3612aea487f37b747f32e772408 (diff)
Fix highdpi conversion of QTabletEvent coordinates on xcb
Amends 1535fc9fb9ddbfce1680979c0634b4fdf8d75fca : when high-dpi scaling is enabled, there was an offset from the cursor position to the event position, because QWindow::mapFromGlobal() works in device-independent pixels, but we are using actual screen pixels here. Task-number: QTBUG-77826 Change-Id: Ic8743b9e5c4041065f530ed1d9d6c49337b0207a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> (cherry picked from commit 9d51fb579bb4655f6740096f17f1ced50258c28f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection_xi2.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
index b754476d61..682cc9525a 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
@@ -1286,16 +1286,14 @@ void QXcbConnection::xi2ReportTabletEvent(const void *event, TabletData *tabletD
if (Q_LIKELY(useValuators)) {
const qreal value = scaleOneValuator(normalizedValue, physicalScreenArea.x(), physicalScreenArea.width());
global.setX(value);
- // mapFromGlobal is ok for nested/embedded windows, but works only with whole-number QPoint;
- // so map it first, then add back the sub-pixel position
- local.setX(window->mapFromGlobal(QPoint(int(value), 0)).x() + (value - int(value)));
+ local.setX(xcbWindow->mapFromGlobalF(global).x());
}
break;
case QXcbAtom::AbsY:
if (Q_LIKELY(useValuators)) {
qreal value = scaleOneValuator(normalizedValue, physicalScreenArea.y(), physicalScreenArea.height());
global.setY(value);
- local.setY(window->mapFromGlobal(QPoint(0, int(value))).y() + (value - int(value)));
+ local.setY(xcbWindow->mapFromGlobalF(global).y());
}
break;
case QXcbAtom::AbsPressure: