diff options
author | Povilas Kanapickas <povilas@radix.lt> | 2021-05-30 19:00:30 +0300 |
---|---|---|
committer | Povilas Kanapickas <povilas@radix.lt> | 2021-08-12 23:14:47 +0300 |
commit | de9d486d2fd9af4024045ae004006b4608fe9d08 (patch) | |
tree | 4dab71450017de0bb9b5a0a86cfeb641742edce6 /src | |
parent | ab2669a9fa3a64a43548ace27c510aed3b19072a (diff) |
Properly scale gesture positions in hi-DPI case
The local/global positions for gestures should be handled the same as
for other events as they mean effectively the same thing.
Change-Id: Ic5ad995607ecd3daf385a7c7be3b67cbae312e7b
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/kernel/qwindowsysteminterface.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index 355ebb87ec..0fd5604193 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -1042,16 +1042,24 @@ void QWindowSystemInterface::handleTabletLeaveProximityEvent(int deviceType, int bool QWindowSystemInterface::handleGestureEvent(QWindow *window, ulong timestamp, const QPointingDevice *device, Qt::NativeGestureType type, const QPointF &local, const QPointF &global, int fingerCount) { + auto localPos = QHighDpi::fromNativeLocalPosition(local, window); + auto globalPos = QHighDpi::fromNativeGlobalPosition(global, window); + QWindowSystemInterfacePrivate::GestureEvent *e = - new QWindowSystemInterfacePrivate::GestureEvent(window, timestamp, type, device, fingerCount, local, global); + new QWindowSystemInterfacePrivate::GestureEvent(window, timestamp, type, device, + fingerCount, localPos, globalPos); return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } bool QWindowSystemInterface::handleGestureEventWithRealValue(QWindow *window, ulong timestamp, const QPointingDevice *device, Qt::NativeGestureType type, qreal value, const QPointF &local, const QPointF &global, int fingerCount) { + auto localPos = QHighDpi::fromNativeLocalPosition(local, window); + auto globalPos = QHighDpi::fromNativeGlobalPosition(global, window); + QWindowSystemInterfacePrivate::GestureEvent *e = - new QWindowSystemInterfacePrivate::GestureEvent(window, timestamp, type, device, fingerCount, local, global); + new QWindowSystemInterfacePrivate::GestureEvent(window, timestamp, type, device, + fingerCount, localPos, globalPos); e->realValue = value; return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } @@ -1060,8 +1068,12 @@ bool QWindowSystemInterface::handleGestureEventWithValueAndDelta(QWindow *window Qt::NativeGestureType type, qreal value, const QPointF &delta, const QPointF &local, const QPointF &global, int fingerCount) { + auto localPos = QHighDpi::fromNativeLocalPosition(local, window); + auto globalPos = QHighDpi::fromNativeGlobalPosition(global, window); + QWindowSystemInterfacePrivate::GestureEvent *e = - new QWindowSystemInterfacePrivate::GestureEvent(window, timestamp, type, device, fingerCount, local, global); + new QWindowSystemInterfacePrivate::GestureEvent(window, timestamp, type, device, + fingerCount, localPos, globalPos); e->realValue = value; e->delta = delta; return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); |