diff options
author | Povilas Kanapickas <povilas@radix.lt> | 2021-01-18 15:58:50 +0200 |
---|---|---|
committer | Povilas Kanapickas <povilas@radix.lt> | 2021-05-28 22:53:32 +0300 |
commit | 4ba3bd736e6ba1835a0b0b51d101101c39a58433 (patch) | |
tree | fe704ec2a5e43ef1a57508b1f509272e1a205239 /src/client/qwaylandinputdevice_p.h | |
parent | d830d425e42d13b274d396816e07c2b450a7977e (diff) |
Implement support for pointer gestures v1
Change-Id: Ie9ee615de123e6deab5b7a5081ca9bcf53399df7
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/client/qwaylandinputdevice_p.h')
-rw-r--r-- | src/client/qwaylandinputdevice_p.h | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/src/client/qwaylandinputdevice_p.h b/src/client/qwaylandinputdevice_p.h index 4a216bc43..0d408d36b 100644 --- a/src/client/qwaylandinputdevice_p.h +++ b/src/client/qwaylandinputdevice_p.h @@ -63,6 +63,7 @@ #include <qpa/qwindowsysteminterface.h> #include <QtWaylandClient/private/qwayland-wayland.h> +#include <QtWaylandClient/private/qwayland-pointer-gestures-unstable-v1.h> #if QT_CONFIG(xkbcommon) #include <QtGui/private/qxkbcommon_p.h> @@ -90,6 +91,9 @@ class QWaylandDisplay; class QWaylandPrimarySelectionDeviceV1; #endif class QWaylandTabletSeatV2; +class QWaylandPointerGestures; +class QWaylandPointerGestureSwipe; +class QWaylandPointerGesturePinch; class QWaylandTextInput; class QWaylandTextInputMethod; #if QT_CONFIG(cursor) @@ -97,6 +101,8 @@ class QWaylandCursorTheme; class CursorSurface; #endif +Q_DECLARE_LOGGING_CATEGORY(lcQpaWaylandInput); + class Q_WAYLAND_CLIENT_EXPORT QWaylandInputDevice : public QObject , public QtWayland::wl_seat @@ -158,6 +164,8 @@ public: Keyboard *keyboard() const; Pointer *pointer() const; + QWaylandPointerGestureSwipe *pointerGestureSwipe() const; + QWaylandPointerGesturePinch *pointerGesturePinch() const; Touch *touch() const; protected: @@ -187,6 +195,8 @@ protected: Keyboard *mKeyboard = nullptr; Pointer *mPointer = nullptr; + QWaylandPointerGestureSwipe *mPointerGestureSwipe = nullptr; + QWaylandPointerGesturePinch *mPointerGesturePinch = nullptr; Touch *mTouch = nullptr; QScopedPointer<QWaylandTextInput> mTextInput; @@ -200,9 +210,13 @@ protected: void handleTouchPoint(int id, Qt::TouchPointState state, const QPointF &surfacePosition = QPoint()); QPointingDevice *mTouchDevice = nullptr; + QPointingDevice *mTouchPadDevice = nullptr; friend class QWaylandTouchExtension; friend class QWaylandQtKeyExtension; + friend class QWaylandPointerGestureSwipe; + friend class QWaylandPointerGesturePinch; + friend class QWaylandWindow; }; inline uint32_t QWaylandInputDevice::serial() const @@ -461,6 +475,63 @@ public: QPointer<QWaylandWindow> surface; }; +#ifndef QT_NO_GESTURES +class QWaylandPointerGestureSwipeEvent +{ + Q_GADGET +public: + inline QWaylandPointerGestureSwipeEvent(QWaylandWindow *surface, Qt::GestureState state, + ulong timestamp, const QPointF &local, + const QPointF &global, uint fingers, const QPointF& delta) + : surface(surface) + , state(state) + , timestamp(timestamp) + , local(local) + , global(global) + , fingers(fingers) + , delta(delta) + {} + + QPointer<QWaylandWindow> surface; + Qt::GestureState state = Qt::GestureState::NoGesture; + ulong timestamp = 0; + QPointF local; + QPointF global; + uint fingers = 0; + QPointF delta; +}; + +class QWaylandPointerGesturePinchEvent +{ + Q_GADGET +public: + inline QWaylandPointerGesturePinchEvent(QWaylandWindow *surface, Qt::GestureState state, + ulong timestamp, const QPointF &local, + const QPointF &global, uint fingers, const QPointF& delta, + qreal scale_delta, qreal rotation_delta) + : surface(surface) + , state(state) + , timestamp(timestamp) + , local(local) + , global(global) + , fingers(fingers) + , delta(delta) + , scale_delta(scale_delta) + , rotation_delta(rotation_delta) + {} + + QPointer<QWaylandWindow> surface; + Qt::GestureState state = Qt::GestureState::NoGesture; + ulong timestamp = 0; + QPointF local; + QPointF global; + uint fingers = 0; + QPointF delta; + qreal scale_delta = 0; + qreal rotation_delta = 0; +}; +#endif // #ifndef QT_NO_GESTURES + } QT_END_NAMESPACE |