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>
bb10
Povilas Kanapickas 2021-05-30 19:00:30 +03:00
parent ab2669a9fa
commit de9d486d2f
1 changed files with 15 additions and 3 deletions

View File

@ -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);