[PATCH] gestures: if fingers don't move, force a gesture by finger position

Peter Hutterer peter.hutterer at who-t.net
Tue Dec 20 03:57:57 UTC 2016


If the fingers rest on the touchpad without moving for a timeout, switch to
pinch or swipe based on the finger position. We already did so for two-fingers
switching to scrolling, now we also do so for 3 and 4 finger gestures. This
gives us better reaction to small movements.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/evdev-mt-touchpad-gestures.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c
index 6c568a3..e54db2a 100644
--- a/src/evdev-mt-touchpad-gestures.c
+++ b/src/evdev-mt-touchpad-gestures.c
@@ -331,10 +331,10 @@ tp_gesture_handle_state_unknown(struct tp_dispatch *tp, uint64_t time)
 	int yres = tp->device->abs.absinfo_y->resolution;
 	int vert_distance;
 
-	/* for two-finger gestures, if the fingers stay unmoving for a
-	 * while, assume (slow) scroll */
-	if (tp->gesture.finger_count == 2) {
-		if (time > (tp->gesture.initial_time + DEFAULT_GESTURE_2FG_SCROLL_TIMEOUT)) {
+	if (time > (tp->gesture.initial_time + DEFAULT_GESTURE_2FG_SCROLL_TIMEOUT)) {
+		/* for two-finger gestures, if the fingers stay unmoving for a
+		 * while, assume (slow) scroll */
+		if (tp->gesture.finger_count == 2) {
 			tp_gesture_set_scroll_buildup(tp);
 			return GESTURE_STATE_SCROLL;
 		}
@@ -346,6 +346,8 @@ tp_gesture_handle_state_unknown(struct tp_dispatch *tp, uint64_t time)
 		    tp->gesture.enabled) {
 			tp_gesture_init_pinch(tp);
 			return GESTURE_STATE_PINCH;
+		} else {
+			return GESTURE_STATE_SWIPE;
 		}
 	}
 
-- 
2.9.3



More information about the wayland-devel mailing list