From 1262c81d9b0d560e7b8cbbecdf05b081d7d94f9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= Date: Wed, 8 Dec 2021 17:32:03 +0100 Subject: [PATCH] gestures: do not use thumb for pinch when is used to press the clickpad MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The changes made in ca3df8a076d54a93b3c2fb8a5eea4326d487050c to improve pinch detection introduced a regression: When the thumb is used to press the clickpad it is automatically tagged as thumb and the gesture state machine does not initialize it, leaving its initial X and Y position set to 0. When another finger is put on the clickpad, the distance moved by the thumb is checked and because its initial position is 0 movement is detected. Add an additional check to take into account only thumbs that are used in the gesture. Fix #708 Signed-off-by: José Expósito --- src/evdev-mt-touchpad-gestures.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c index dc2b6536..bf259423 100644 --- a/src/evdev-mt-touchpad-gestures.c +++ b/src/evdev-mt-touchpad-gestures.c @@ -1283,6 +1283,9 @@ tp_gesture_thumb_moved(struct tp_dispatch *tp) if (!thumb) return false; + if (!tp_touch_active_for_gesture(tp, thumb)) + return false; + thumb_moved = tp_gesture_mm_moved(tp, thumb); thumb_mm = hypot(thumb_moved.x, thumb_moved.y); return thumb_mm >= PINCH_DISAMBIGUATION_MOVE_THRESHOLD;