Skip to content

Add support for gestures

Peter Hutterer requested to merge whot/libei:wip/gestures into main

This MR supports swipe/pinch/hold gestures in a matter similar to wayland's pointer-gestures (protocol) and libinput (the C API).

On the protocol level we have three new interfaces: ei_gestures_swipe, ei_gestures_pinch, ei_gestures_hold with the usual begin/update/end gesture sequence. Like libinput this makes it possible (in theory) to have multiple simultaneous gestures per device but only one gesture by type (i.e. swipe + pinch is possible but not swipe + swipe). Like wayland/libinput gestures have a fixed finger count, to change fingers the previous gesture needs to be cancelled.

The C API exposes it simliar to the touch API with ei_device_new_swipe() and ei_swipe_begin()/update()/end(). Only one EI_DEVICE_CAP_GESTURE is available, the library sets it if any of the gestures is supported.

The event API matches the libinput one with EI_EVENT_SWIPE_BEGIN etc. swipes have dx/dy, pinches also have scale and rotation, same as the wayland/libinput APIS.

cc @jadahl, @mahkoh

Closes #64

Note: draft because it needs more test cases but the basics seem to work correctly.

Edited by Peter Hutterer

Merge request reports

Loading