[PATCH libinput] touchpad: only check for vertical finger distribution on 2fg gestures

Peter Hutterer peter.hutterer at who-t.net
Tue Jun 28 06:22:19 UTC 2016


A natural hand position for a 4-finger swipe will have one finger well below
the other triggering the pinch detection. This is obviously wrong, only do the
finger position analysis when we have 2 fingers.

This is only a partial fix, for 3-4 finger gestures chances are high that the
third/fourth finger come in a different event frame. Before that we likely
detect 2 fingers in a possible pinch position and still trigger the code path.
This issue has to be fixed separately.

https://bugs.freedesktop.org/show_bug.cgi?id=96687

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

diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c
index a8ff37e..e4e465a 100644
--- a/src/evdev-mt-touchpad-gestures.c
+++ b/src/evdev-mt-touchpad-gestures.c
@@ -330,19 +330,20 @@ tp_gesture_handle_state_unknown(struct tp_dispatch *tp, uint64_t time)
 
 	/* for two-finger gestures, if the fingers stay unmoving for a
 	 * while, assume (slow) scroll */
-	if (tp->gesture.finger_count == 2 &&
-	    time > (tp->gesture.initial_time + DEFAULT_GESTURE_2FG_SCROLL_TIMEOUT)) {
-		tp_gesture_set_scroll_buildup(tp);
-		return GESTURE_STATE_SCROLL;
-	}
+	if (tp->gesture.finger_count == 2) {
+		if (time > (tp->gesture.initial_time + DEFAULT_GESTURE_2FG_SCROLL_TIMEOUT)) {
+			tp_gesture_set_scroll_buildup(tp);
+			return GESTURE_STATE_SCROLL;
+		}
 
-	/* Else check if one finger is > 20mm below the others */
-	vert_distance = abs(first->point.y - second->point.y);
-	if (vert_distance > 20 * yres &&
-	    tp->gesture.finger_count > 2 &&
-	    tp->gesture.enabled) {
-		tp_gesture_init_pinch(tp);
-		return GESTURE_STATE_PINCH;
+		/* Else check if one finger is > 20mm below the others */
+		vert_distance = abs(first->point.y - second->point.y);
+		if (vert_distance > 20 * yres &&
+		    tp->gesture.finger_count > 2 &&
+		    tp->gesture.enabled) {
+			tp_gesture_init_pinch(tp);
+			return GESTURE_STATE_PINCH;
+		}
 	}
 
 	/* Else wait for both fingers to have moved */
-- 
2.7.4



More information about the wayland-devel mailing list