From 080bac39c844bd16b7e1493797c6e7644badf0ab Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Sun, 30 May 2021 13:26:32 +0300 Subject: xi: Implement grab support for new gesture event types --- Xi/exevents.c | 6 +++--- Xi/xipassivegrab.c | 29 +++++++++++++++++++++++++---- 2 files changed, 28 insertions(+), 7 deletions(-) (limited to 'Xi') diff --git a/Xi/exevents.c b/Xi/exevents.c index c8751ce18..83ea387ab 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -2427,8 +2427,8 @@ GrabWindow(ClientPtr client, DeviceIntPtr dev, int type, /* Touch grab */ int -GrabTouch(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr mod_dev, - GrabParameters *param, GrabMask *mask) +GrabTouchOrGesture(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr mod_dev, + int type, GrabParameters *param, GrabMask *mask) { WindowPtr pWin; GrabPtr grab; @@ -2446,7 +2446,7 @@ GrabTouch(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr mod_dev, return rc; grab = CreateGrab(client->index, dev, mod_dev, pWin, XI2, - mask, param, XI_TouchBegin, 0, NullWindow, NullCursor); + mask, param, type, 0, NullWindow, NullCursor); if (!grab) return BadAlloc; diff --git a/Xi/xipassivegrab.c b/Xi/xipassivegrab.c index d30f51f3c..2769fb7c9 100644 --- a/Xi/xipassivegrab.c +++ b/Xi/xipassivegrab.c @@ -114,14 +114,18 @@ ProcXIPassiveGrabDevice(ClientPtr client) stuff->grab_type != XIGrabtypeKeycode && stuff->grab_type != XIGrabtypeEnter && stuff->grab_type != XIGrabtypeFocusIn && - stuff->grab_type != XIGrabtypeTouchBegin) { + stuff->grab_type != XIGrabtypeTouchBegin && + stuff->grab_type != XIGrabtypeGesturePinchBegin && + stuff->grab_type != XIGrabtypeGestureSwipeBegin) { client->errorValue = stuff->grab_type; return BadValue; } if ((stuff->grab_type == XIGrabtypeEnter || stuff->grab_type == XIGrabtypeFocusIn || - stuff->grab_type == XIGrabtypeTouchBegin) && stuff->detail != 0) { + stuff->grab_type == XIGrabtypeTouchBegin || + stuff->grab_type == XIGrabtypeGesturePinchBegin || + stuff->grab_type == XIGrabtypeGestureSwipeBegin) && stuff->detail != 0) { client->errorValue = stuff->detail; return BadValue; } @@ -217,7 +221,16 @@ ProcXIPassiveGrabDevice(ClientPtr client) status = GrabWindow(client, dev, stuff->grab_type, ¶m, &mask); break; case XIGrabtypeTouchBegin: - status = GrabTouch(client, dev, mod_dev, ¶m, &mask); + status = GrabTouchOrGesture(client, dev, mod_dev, XI_TouchBegin, + ¶m, &mask); + break; + case XIGrabtypeGesturePinchBegin: + status = GrabTouchOrGesture(client, dev, mod_dev, + XI_GesturePinchBegin, ¶m, &mask); + break; + case XIGrabtypeGestureSwipeBegin: + status = GrabTouchOrGesture(client, dev, mod_dev, + XI_GestureSwipeBegin, ¶m, &mask); break; } @@ -307,7 +320,9 @@ ProcXIPassiveUngrabDevice(ClientPtr client) stuff->grab_type != XIGrabtypeKeycode && stuff->grab_type != XIGrabtypeEnter && stuff->grab_type != XIGrabtypeFocusIn && - stuff->grab_type != XIGrabtypeTouchBegin) { + stuff->grab_type != XIGrabtypeTouchBegin && + stuff->grab_type != XIGrabtypeGesturePinchBegin && + stuff->grab_type != XIGrabtypeGestureSwipeBegin) { client->errorValue = stuff->grab_type; return BadValue; } @@ -348,6 +363,12 @@ ProcXIPassiveUngrabDevice(ClientPtr client) case XIGrabtypeTouchBegin: tempGrab->type = XI_TouchBegin; break; + case XIGrabtypeGesturePinchBegin: + tempGrab->type = XI_GesturePinchBegin; + break; + case XIGrabtypeGestureSwipeBegin: + tempGrab->type = XI_GestureSwipeBegin; + break; } tempGrab->grabtype = XI2; tempGrab->modifierDevice = mod_dev; -- cgit v1.2.3