Add support for swipe gestures. Signed-off-by: Hans de Goede <hdego...@redhat.com> --- src/evdev-mt-touchpad-gestures.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c index e429efe..faf5824 100644 --- a/src/evdev-mt-touchpad-gestures.c +++ b/src/evdev-mt-touchpad-gestures.c @@ -25,6 +25,7 @@ #include <assert.h> #include <math.h> #include <stdbool.h> +#include <stdio.h> #include <limits.h> #include "evdev-mt-touchpad.h" @@ -70,6 +71,13 @@ tp_gesture_start(struct tp_dispatch *tp, uint64_t time) case 2: /* NOP */ break; + case 3: + case 4: + gesture_notify_swipe(&tp->device->base, time, + LIBINPUT_EVENT_GESTURE_SWIPE_START, + tp->gesture.finger_mode, + 0, 0, 0, 0); + break; } tp->gesture.started = true; } @@ -112,6 +120,23 @@ tp_gesture_post_twofinger_scroll(struct tp_dispatch *tp, uint64_t time) dx, dy); } +static void +tp_gesture_post_swipe(struct tp_dispatch *tp, uint64_t time) +{ + double dx, dy, dx_unaccel, dy_unaccel; + + tp_get_touches_delta(tp, &dx, &dy, true); + tp_filter_motion(tp, &dx, &dy, &dx_unaccel, &dy_unaccel, time); + + if (dx != 0.0 || dy != 0.0 || dx_unaccel != 0.0 || dy_unaccel != 0.0) { + tp_gesture_start(tp, time); + gesture_notify_swipe(&tp->device->base, time, + LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE, + tp->gesture.finger_mode, + dx, dy, dx_unaccel, dy_unaccel); + } +} + void tp_gesture_post_events(struct tp_dispatch *tp, uint64_t time) { @@ -136,6 +161,10 @@ tp_gesture_post_events(struct tp_dispatch *tp, uint64_t time) case 2: tp_gesture_post_twofinger_scroll(tp, time); break; + case 3: + case 4: + tp_gesture_post_swipe(tp, time); + break; } } @@ -157,6 +186,13 @@ tp_gesture_stop(struct tp_dispatch *tp, uint64_t time) case 2: tp_gesture_stop_twofinger_scroll(tp, time); break; + case 3: + case 4: + gesture_notify_swipe(&tp->device->base, time, + LIBINPUT_EVENT_GESTURE_SWIPE_END, + tp->gesture.finger_mode, + 0, 0, 0, 0); + break; } tp->gesture.started = false; } -- 2.1.0 _______________________________________________ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel