From d74ffaed9183a94d47bc7397b14a2fd21d67e230 Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Mon, 21 Sep 2020 04:03:43 +0300 Subject: include: Add support for XI 2.4 gesture input events Signed-off-by: Povilas Kanapickas --- include/X11/extensions/XI2.h | 18 ++++++++- include/X11/extensions/XI2proto.h | 77 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+), 2 deletions(-) (limited to 'include/X11') diff --git a/include/X11/extensions/XI2.h b/include/X11/extensions/XI2.h index 5a1c66a..cc47085 100644 --- a/include/X11/extensions/XI2.h +++ b/include/X11/extensions/XI2.h @@ -30,7 +30,7 @@ See commit libXi-1.4.2-21-ge8531dd */ #define XI_2_Major 2 -#define XI_2_Minor 3 +#define XI_2_Minor 4 /* Property event flags */ #define XIPropertyDeleted 0 @@ -85,6 +85,8 @@ #define XIGrabtypeEnter 2 #define XIGrabtypeFocusIn 3 #define XIGrabtypeTouchBegin 4 +#define XIGrabtypeGesturePinchBegin 5 +#define XIGrabtypeGestureSwipeBegin 6 /* Passive grab modifier */ #define XIAnyModifier (1U << 31) @@ -142,6 +144,7 @@ #define XIValuatorClass 2 #define XIScrollClass 3 #define XITouchClass 8 +#define XIGestureClass 9 /* Scroll class types */ #define XIScrollTypeVertical 1 @@ -164,6 +167,11 @@ #define XIBarrierPointerReleased (1 << 0) #define XIBarrierDeviceIsGrabbed (1 << 1) +/* Gesture pinch event flags */ +#define XIGesturePinchEventCancelled (1 << 0) + +/* Gesture swipe event flags */ +#define XIGestureSwipeEventCancelled (1 << 0) /* Touch modes */ #define XIDirectTouch 1 @@ -206,7 +214,13 @@ #define XI_RawTouchEnd 24 #define XI_BarrierHit 25 /* XI 2.3 */ #define XI_BarrierLeave 26 -#define XI_LASTEVENT XI_BarrierLeave +#define XI_GesturePinchBegin 27 /* XI 2.4 */ +#define XI_GesturePinchUpdate 28 +#define XI_GesturePinchEnd 29 +#define XI_GestureSwipeBegin 30 +#define XI_GestureSwipeUpdate 31 +#define XI_GestureSwipeEnd 32 +#define XI_LASTEVENT XI_GestureSwipeEnd /* NOTE: XI2LASTEVENT in xserver/include/inputstr.h must be the same value * as XI_LASTEVENT if the server is supposed to handle masks etc. for this * type of event. */ diff --git a/include/X11/extensions/XI2proto.h b/include/X11/extensions/XI2proto.h index a1133b5..aaeac7b 100644 --- a/include/X11/extensions/XI2proto.h +++ b/include/X11/extensions/XI2proto.h @@ -218,6 +218,17 @@ typedef struct { uint8_t num_touches; /**< Maximum number of touches (0==unlimited) */ } xXITouchInfo; +/** + * Denotes touchpad gesture capability on a device. + */ +typedef struct { + uint16_t type; /**< Always GestureClass */ + uint16_t length; /**< Length in 4 byte units */ + uint16_t sourceid; /**< source device for this class */ + uint8_t num_touches; /**< Maximum number of touches gesture supports (0==unlimited) */ + uint8_t pad0; +} xXIGestureInfo; + /** * Used to select for events on a given window. * Struct is followed by (mask_len * CARD8), with each bit set representing @@ -1083,6 +1094,72 @@ typedef xXIBarrierEvent xXIBarrierHitEvent; typedef xXIBarrierEvent xXIBarrierPointerReleasedEvent; typedef xXIBarrierEvent xXIBarrierLeaveEvent; +/** + * Event for touchpad gesture pinch input events + */ +typedef struct +{ + uint8_t type; /**< Always GenericEvent */ + uint8_t extension; /**< XI extension offset */ + uint16_t sequenceNumber; + uint32_t length; /**< Length in 4 byte uints */ + uint16_t evtype; + uint16_t deviceid; + Time time; + uint32_t detail; /**< The number of touches in the gesture */ + Window root; + Window event; + Window child; +/* └──────── 32 byte boundary ────────┘ */ + FP1616 root_x; /**< Always screen coords, 16.16 fixed point */ + FP1616 root_y; + FP1616 event_x; /**< Always screen coords, 16.16 fixed point */ + FP1616 event_y; + FP1616 delta_x; + FP1616 delta_y; + FP1616 delta_unaccel_x; + FP1616 delta_unaccel_y; + FP1616 scale; + FP1616 delta_angle; + uint16_t sourceid; /**< The source device */ + uint16_t pad0; + xXIModifierInfo mods; + xXIGroupInfo group; + uint32_t flags; /**< ::XIGesturePinchEventCancelled */ +} xXIGesturePinchEvent; + +/** + * Event for touchpad gesture swipe input events + */ +typedef struct +{ + uint8_t type; /**< Always GenericEvent */ + uint8_t extension; /**< XI extension offset */ + uint16_t sequenceNumber; + uint32_t length; /**< Length in 4 byte uints */ + uint16_t evtype; + uint16_t deviceid; + Time time; + uint32_t detail; /**< The number of touches in the gesture */ + Window root; + Window event; + Window child; +/* └──────── 32 byte boundary ────────┘ */ + FP1616 root_x; /**< Always screen coords, 16.16 fixed point */ + FP1616 root_y; + FP1616 event_x; /**< Always screen coords, 16.16 fixed point */ + FP1616 event_y; + FP1616 delta_x; + FP1616 delta_y; + FP1616 delta_unaccel_x; + FP1616 delta_unaccel_y; + uint16_t sourceid; /**< The source device */ + uint16_t pad0; + xXIModifierInfo mods; + xXIGroupInfo group; + uint32_t flags; /**< ::XIGestureSwipeEventCancelled */ +} xXIGestureSwipeEvent; + #undef Window #undef Time #undef Atom -- cgit v1.2.3