summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qwindowsysteminterface.h
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2020-06-10 15:32:26 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2020-06-18 18:53:40 +0200
commit28ef8d283db336d0d1641b8fbab31eac5b46a498 (patch)
treee349521d8d16c35adb248d3ca3e88dd869f33fc2 /src/gui/kernel/qwindowsysteminterface.h
parent68de38ded1c0e5387ae29aacaee50ba5dacfc59a (diff)
Add QPointingDevice argument to every QWSI input event handler function
We want every QInputEvent to carry a valid device pointer. It may be some time until all QPA plugins are sending it, but it's necessary to provide the functions for them to start doing that. We now try to maintain the same order of arguments to all the functions. handleTouchEvent(window, timestamp, device, the rest) was already there (except "device" has changed type now), and is used in a lot of platform plugins; so it seems easiest to let that set the precedent, and modify the rest to match. We do that by adding new functions; we can deprecate the older functions after it becomes clear that the new ones work well. However the handleGestureEvent functions have only ever been used in the cocoa plugin, so it's easy to change their argument order right now. Modify tst_qwindow::tabletEvents() to test new tablet event API. Task-number: QTBUG-46412 Change-Id: I1828b61183cf51f3a08774936156c6a91cfc9a12 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/gui/kernel/qwindowsysteminterface.h')
-rw-r--r--src/gui/kernel/qwindowsysteminterface.h53
1 files changed, 43 insertions, 10 deletions
diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h
index 905498a62b..7445ca475f 100644
--- a/src/gui/kernel/qwindowsysteminterface.h
+++ b/src/gui/kernel/qwindowsysteminterface.h
@@ -87,6 +87,12 @@ public:
Qt::MouseButton button, QEvent::Type type,
Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
+ template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
+ static bool handleMouseEvent(QWindow *window, ulong timestamp, const QPointingDevice *device,
+ const QPointF &local, const QPointF &global, Qt::MouseButtons state,
+ Qt::MouseButton button, QEvent::Type type,
+ Qt::KeyboardModifiers mods = Qt::NoModifier,
+ Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
static bool handleFrameStrutMouseEvent(QWindow *window, const QPointF &local,
const QPointF &global, Qt::MouseButtons state,
@@ -100,6 +106,11 @@ public:
Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::MouseEventSource source =
Qt::MouseEventNotSynthesized);
+ static bool handleFrameStrutMouseEvent(QWindow *window, ulong timestamp, const QPointingDevice *device,
+ const QPointF &local, const QPointF &global, Qt::MouseButtons state,
+ Qt::MouseButton button, QEvent::Type type,
+ Qt::KeyboardModifiers mods = Qt::NoModifier,
+ Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
static bool handleShortcutEvent(QWindow *window, ulong timestamp, int k, Qt::KeyboardModifiers mods, quint32 nativeScanCode,
quint32 nativeVirtualKey, quint32 nativeModifiers, const QString & text = QString(), bool autorep = false, ushort count = 1);
@@ -119,6 +130,12 @@ public:
quint32 nativeModifiers,
const QString& text = QString(), bool autorep = false,
ushort count = 1, bool tryShortcutOverride = true);
+ static bool handleExtendedKeyEvent(QWindow *window, ulong timestamp, const QInputDevice *device,
+ QEvent::Type type, int key, Qt::KeyboardModifiers modifiers,
+ quint32 nativeScanCode, quint32 nativeVirtualKey,
+ quint32 nativeModifiers,
+ const QString& text = QString(), bool autorep = false,
+ ushort count = 1, bool tryShortcutOverride = true);
static bool handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global,
QPoint pixelDelta, QPoint angleDelta,
Qt::KeyboardModifiers mods = Qt::NoModifier,
@@ -130,6 +147,13 @@ public:
Qt::ScrollPhase phase = Qt::NoScrollPhase,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized,
bool inverted = false);
+ static bool handleWheelEvent(QWindow *window, ulong timestamp, const QPointingDevice *device,
+ const QPointF &local, const QPointF &global,
+ QPoint pixelDelta, QPoint angleDelta,
+ Qt::KeyboardModifiers mods = Qt::NoModifier,
+ Qt::ScrollPhase phase = Qt::NoScrollPhase,
+ Qt::MouseEventSource source = Qt::MouseEventNotSynthesized,
+ bool inverted = false);
struct TouchPoint {
TouchPoint() : id(0), uniqueId(-1), pressure(0), rotation(0), state(Qt::TouchPointStationary) { }
@@ -225,6 +249,10 @@ public:
static void handleFileOpenEvent(const QString& fileName);
static void handleFileOpenEvent(const QUrl &url);
+ static bool handleTabletEvent(QWindow *window, ulong timestamp, const QPointingDevice *device,
+ const QPointF &local, const QPointF &global,
+ Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt,
+ qreal tangentialPressure, qreal rotation, int z, Qt::KeyboardModifiers modifiers = Qt::NoModifier);
static bool handleTabletEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global,
int device, int pointerType, Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt,
qreal tangentialPressure, qreal rotation, int z, qint64 uid,
@@ -233,18 +261,23 @@ public:
int device, int pointerType, Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt,
qreal tangentialPressure, qreal rotation, int z, qint64 uid,
Qt::KeyboardModifiers modifiers = Qt::NoModifier);
- static bool handleTabletEnterProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid);
- static void handleTabletEnterProximityEvent(int device, int pointerType, qint64 uid);
- static bool handleTabletLeaveProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid);
- static void handleTabletLeaveProximityEvent(int device, int pointerType, qint64 uid);
+ static bool handleTabletEnterLeaveProximityEvent(QWindow *window, ulong timestamp, const QPointingDevice *device,
+ bool inProximity, const QPointF &local = QPointF(), const QPointF &global = QPointF(),
+ Qt::MouseButtons buttons = {}, int xTilt = 0, int yTilt = 0,
+ qreal tangentialPressure = 0, qreal rotation = 0, int z = 0,
+ Qt::KeyboardModifiers modifiers = Qt::NoModifier);
+ static bool handleTabletEnterProximityEvent(ulong timestamp, int deviceType, int pointerType, qint64 uid);
+ static void handleTabletEnterProximityEvent(int deviceType, int pointerType, qint64 uid);
+ static bool handleTabletLeaveProximityEvent(ulong timestamp, int deviceType, int pointerType, qint64 uid);
+ static void handleTabletLeaveProximityEvent(int deviceType, int pointerType, qint64 uid);
#ifndef QT_NO_GESTURES
- static bool handleGestureEvent(QWindow *window, const QPointingDevice *device, ulong timestamp, Qt::NativeGestureType type,
- QPointF &local, QPointF &global);
- static bool handleGestureEventWithRealValue(QWindow *window, const QPointingDevice *device, ulong timestamp, Qt::NativeGestureType type,
- qreal value, QPointF &local, QPointF &global);
- static bool handleGestureEventWithSequenceIdAndValue(QWindow *window, const QPointingDevice *device, ulong timestamp,Qt::NativeGestureType type,
- ulong sequenceId, quint64 value, QPointF &local, QPointF &global);
+ static bool handleGestureEvent(QWindow *window, ulong timestamp, const QPointingDevice *device, Qt::NativeGestureType type,
+ const QPointF &local, const QPointF &global);
+ static bool handleGestureEventWithRealValue(QWindow *window, ulong timestamp, const QPointingDevice *device, Qt::NativeGestureType type,
+ qreal value, const QPointF &local, const QPointF &global);
+ static bool handleGestureEventWithSequenceIdAndValue(QWindow *window, ulong timestamp, const QPointingDevice *device, Qt::NativeGestureType type,
+ ulong sequenceId, quint64 value, const QPointF &local, const QPointF &global);
#endif // QT_NO_GESTURES
static void handlePlatformPanelEvent(QWindow *window);