/
0022-Fix-highdpi-conversion-of-QTabletEvent-coordinates-o.patch
52 lines (48 loc) · 2.39 KB
/
0022-Fix-highdpi-conversion-of-QTabletEvent-coordinates-o.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
From 4fe479fe3d5e2af0a2ce89df000cdb9ff4606e1e Mon Sep 17 00:00:00 2001
From: Shawn Rutledge <shawn.rutledge@qt.io>
Date: Fri, 4 Dec 2020 10:28:26 +0100
Subject: [PATCH 022/144] Fix highdpi conversion of QTabletEvent coordinates on
xcb
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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.
Pick-to: 6.0
Pick-to: 5.15
Pick-to: 5.12
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)
---
src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
index 1ced02f31d..e49edbd34e 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
@@ -1255,16 +1255,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:
--
2.43.0