diff options
author | Povilas Kanapickas <povilas@radix.lt> | 2021-05-30 13:26:33 +0300 |
---|---|---|
committer | Povilas Kanapickas <povilas@radix.lt> | 2021-05-30 13:26:33 +0300 |
commit | 81909546397eb180ed8983bdb80f5673dbae71ac (patch) | |
tree | b57663d45fcb59afe032df09582434706672cd96 /Xi | |
parent | 080bac39c844bd16b7e1493797c6e7644badf0ab (diff) |
xi: Implement selection logic for gesture event types
Diffstat (limited to 'Xi')
-rw-r--r-- | Xi/xiselectev.c | 53 |
1 files changed, 51 insertions, 2 deletions
diff --git a/Xi/xiselectev.c b/Xi/xiselectev.c index 0266a8d30..edcb8a0d3 100644 --- a/Xi/xiselectev.c +++ b/Xi/xiselectev.c @@ -226,8 +226,41 @@ ProcXISelectEvents(ClientPtr client) return BadValue; } - /* Only one client per window may select for touch events on the - * same devices, including master devices. + /* All three pinch gesture events must be selected at once */ + if ((BitIsOn(bits, XI_GesturePinchBegin) || + BitIsOn(bits, XI_GesturePinchUpdate) || + BitIsOn(bits, XI_GesturePinchEnd)) && + (!BitIsOn(bits, XI_GesturePinchBegin) || + !BitIsOn(bits, XI_GesturePinchUpdate) || + !BitIsOn(bits, XI_GesturePinchEnd))) { + client->errorValue = XI_GesturePinchBegin; + return BadValue; + } + + /* All three swipe gesture events must be selected at once. Note + that the XI_GestureSwipeEnd is at index 32 which is on the next + 4-byte mask element */ + if (evmask->mask_len == 1 && + (BitIsOn(bits, XI_GestureSwipeBegin) || + BitIsOn(bits, XI_GestureSwipeUpdate))) + { + client->errorValue = XI_GestureSwipeBegin; + return BadValue; + } + + if (evmask->mask_len >= 2 && + (BitIsOn(bits, XI_GestureSwipeBegin) || + BitIsOn(bits, XI_GestureSwipeUpdate) || + BitIsOn(bits, XI_GestureSwipeEnd)) && + (!BitIsOn(bits, XI_GestureSwipeBegin) || + !BitIsOn(bits, XI_GestureSwipeUpdate) || + !BitIsOn(bits, XI_GestureSwipeEnd))) { + client->errorValue = XI_GestureSwipeBegin; + return BadValue; + } + + /* Only one client per window may select for touch or gesture events + * on the same devices, including master devices. * XXX: This breaks if a device goes from floating to attached. */ if (BitIsOn(bits, XI_TouchBegin)) { rc = check_for_touch_selection_conflicts(client, @@ -237,6 +270,22 @@ ProcXISelectEvents(ClientPtr client) if (rc != Success) return rc; } + if (BitIsOn(bits, XI_GesturePinchBegin)) { + rc = check_for_touch_selection_conflicts(client, + win, + evmask->deviceid, + XI_GesturePinchBegin); + if (rc != Success) + return rc; + } + if (BitIsOn(bits, XI_GestureSwipeBegin)) { + rc = check_for_touch_selection_conflicts(client, + win, + evmask->deviceid, + XI_GestureSwipeBegin); + if (rc != Success) + return rc; + } } if (XICheckInvalidMaskBits(client, (unsigned char *) &evmask[1], |