[PATCH libinput] touchpad: drop thumb handling from gestures

Peter Hutterer peter.hutterer at who-t.net
Tue Jul 14 19:32:19 PDT 2015


Thumb detection interfered with gestures a fair bit but it shouldn't. A pinch
gesture with a thumb is a fairly natural move so we shouldn't cancel that.
A swipe gesture with a thumb on the touchpad - well, don't do that. No need
for code here.

Reported-by: Carlos Garnacho <carlosg at gnome.org>
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/evdev-mt-touchpad-gestures.c | 19 -------------------
 src/evdev-mt-touchpad.c          |  2 +-
 src/evdev-mt-touchpad.h          |  1 -
 3 files changed, 1 insertion(+), 21 deletions(-)

diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c
index 768d3ec..a23b5ce 100644
--- a/src/evdev-mt-touchpad-gestures.c
+++ b/src/evdev-mt-touchpad-gestures.c
@@ -546,34 +546,15 @@ tp_gesture_handle_state(struct tp_dispatch *tp, uint64_t time)
 {
 	unsigned int active_touches = 0;
 	struct tp_touch *t;
-	uint32_t old_thumb_mask, thumb_mask = 0;
 	int i = 0;
 
 	tp_for_each_touch(tp, t) {
 		if (tp_touch_active(tp, t))
 			active_touches++;
 
-		if (t->is_thumb)
-			thumb_mask |= 1 << i;
 		i++;
 	}
 
-	old_thumb_mask = tp->gesture.thumb_mask;
-	tp->gesture.thumb_mask = thumb_mask;
-
-	/* active touches does not include thumb touches, need to count those
-	 * separately, in a bitmask.
-	 * then, if the finger count changes and/or the thumb count changes
-	 * -> cancel gesture.
-	 */
-	if (thumb_mask != old_thumb_mask) {
-		/* if a thumb is detected during a gesture, that gesture is
-		 * cancelled and the user effectively needs to restart. we
-		 * could be smarter, but the complexity isn't worth it */
-		tp_gesture_cancel(tp, time);
-		return;
-	}
-
 	if (active_touches != tp->gesture.finger_count) {
 		/* If all fingers are lifted immediately end the gesture */
 		if (active_touches == 0) {
diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index bbba665..cbe8bed 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -629,7 +629,7 @@ tp_thumb_detect(struct tp_dispatch *tp, struct tp_touch *t)
 	 * - clickfinger must ignore this touch for finger count
 	 * - software buttons are unaffected
 	 * - edge scrolling unaffected
-	 * - gestures: cancel
+	 * - gestures: unaffected
 	 * - tapping: honour thumb on begin, ignore it otherwise for now,
 	 *   this gets a tad complicated otherwise
 	 */
diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h
index eda17a9..61c4166 100644
--- a/src/evdev-mt-touchpad.h
+++ b/src/evdev-mt-touchpad.h
@@ -237,7 +237,6 @@ struct tp_dispatch {
 		double prev_scale;
 		double angle;
 		struct device_float_coords center;
-		uint32_t thumb_mask;
 	} gesture;
 
 	struct {
-- 
2.4.3



More information about the wayland-devel mailing list