summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qwindowsysteminterface.cpp
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2021-03-26 14:10:28 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2021-04-27 20:12:50 +0200
commit31f90e99b8f04d9a228c5a0b01319b3f112c1490 (patch)
treec9253bb4457b7d0572f78647f848ea7eff338139 /src/gui/kernel/qwindowsysteminterface.cpp
parent62f5a6ca4274d72bab78db4bc374c481717871b0 (diff)
Add storage for (pixel) deltas and fingerCount to QNativeGestureEvent
It's not clear now whether trackpad gestures on Windows will need to be so different than on macOS; however, any reasonable int value can be stored in a qreal, and in Qt Quick we like to use floating-point numbers for all "real" values and measurements. So since we need to add more storage, and quint64 m_intValue has never been used, we now replace it with a QVector2D, which should have the same size. The intended use is that PanNativeGesture will include a displacement, probably in pixels, by which the viewport or some target item should be panned or moved. The naming of deltas() is flexible enough to support any gesture with some incremental 2D valuators, though, just as value() has gesture-dependent semantics. fingerCount() will be useful for Qt Quick pointer handlers to filter out events that have the wrong number of fingers, e.g. to require that either a 3-finger pan gesture or 3 individual touchpoints are required to activate DragHandler { minimumPointCount: 3 } (assuming we implement pan gesture support in DragHandler). Fixes: QTBUG-92179 Task-number: QTBUG-92098 Change-Id: I5462aea9047beed6e99075294a62011edd8a59f5 Reviewed-by: Povilas Kanapickas <povilas@radix.lt> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/gui/kernel/qwindowsysteminterface.cpp')
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index a79ff07c54..dcce42ffe0 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -1043,21 +1043,32 @@ void QWindowSystemInterface::handleTabletLeaveProximityEvent(int deviceType, int
#ifndef QT_NO_GESTURES
bool QWindowSystemInterface::handleGestureEvent(QWindow *window, ulong timestamp, const QPointingDevice *device,
- Qt::NativeGestureType type, const QPointF &local, const QPointF &global)
+ Qt::NativeGestureType type, const QPointF &local, const QPointF &global, int fingerCount)
{
QWindowSystemInterfacePrivate::GestureEvent *e =
- new QWindowSystemInterfacePrivate::GestureEvent(window, timestamp, type, device, local, global);
+ new QWindowSystemInterfacePrivate::GestureEvent(window, timestamp, type, device, fingerCount, local, global);
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)
+ Qt::NativeGestureType type, qreal value, const QPointF &local, const QPointF &global, int fingerCount)
{
QWindowSystemInterfacePrivate::GestureEvent *e =
- new QWindowSystemInterfacePrivate::GestureEvent(window, timestamp, type, device, local, global);
+ new QWindowSystemInterfacePrivate::GestureEvent(window, timestamp, type, device, fingerCount, local, global);
e->realValue = value;
return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
}
+
+bool QWindowSystemInterface::handleGestureEventWithValueAndDeltas(QWindow *window, ulong timestamp, const QPointingDevice *device,
+ Qt::NativeGestureType type, qreal value, QVector2D deltas,
+ const QPointF &local, const QPointF &global, int fingerCount)
+{
+ QWindowSystemInterfacePrivate::GestureEvent *e =
+ new QWindowSystemInterfacePrivate::GestureEvent(window, timestamp, type, device, fingerCount, local, global);
+ e->realValue = value;
+ e->deltas = deltas;
+ return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+}
#endif // QT_NO_GESTURES
void QWindowSystemInterface::handlePlatformPanelEvent(QWindow *w)