input: Add basic pointer gesture support

Passing of gesture events added in #4794 allows to use them in clients
but not in sway itself, for example to switch workspaces using
three-finger swipes.

Add support for binding four basic directional swipes to arbitrary sway
commands. Add the necessary handling to default seatops to execute them
at the beginning or end of a swipe gesture. This for now responds to all
swipes, ignoring the number of fingers used.

The former throws up the intrinsic conundrum that we can not know the
kind of swipe that's going to happen because it can change all through
its lifecylce. Therefore we can only execute bindings on release.

Test plan:
- add workspace switching to config like so:

bindsym --whole-window SWIPE_LEFT workspace prev_on_output
bindsym --whole-window SWIPE_RIGHT workspace next_on_output

- start sway and open two workspaces
- switch back and forth using horizontal three-finger swipes, observing
  that vertical swipes won't

Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
This commit is contained in:
Michael Weiser 2020-01-25 18:23:59 +01:00
parent b518870bc1
commit 44a2a60dcd
3 changed files with 195 additions and 6 deletions

View file

@ -14,6 +14,10 @@
#define SWAY_SCROLL_DOWN KEY_MAX + 2
#define SWAY_SCROLL_LEFT KEY_MAX + 3
#define SWAY_SCROLL_RIGHT KEY_MAX + 4
#define SWAY_SWIPE_UP KEY_MAX + 5
#define SWAY_SWIPE_DOWN KEY_MAX + 6
#define SWAY_SWIPE_LEFT KEY_MAX + 7
#define SWAY_SWIPE_RIGHT KEY_MAX + 8
struct sway_cursor {
struct sway_seat *seat;