[PATCH libinput v3 14/17] touchpad: Ignore fingers in button area for 2 finger scroll

Hans de Goede hdegoede at redhat.com
Tue May 20 07:35:02 PDT 2014


Signed-off-by: Hans de Goede <hdegoede at redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/evdev-mt-touchpad.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index f5e0300..fc4a4f7 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -445,7 +445,7 @@ tp_post_twofinger_scroll(struct tp_dispatch *tp, uint32_t time)
 	double tmpx, tmpy;
 
 	tp_for_each_touch(tp, t) {
-		if (t->dirty) {
+		if (tp_touch_active(tp, t) && t->dirty) {
 			nchanged++;
 			tp_get_delta(t, &tmpx, &tmpy);
 
@@ -498,12 +498,21 @@ tp_post_twofinger_scroll(struct tp_dispatch *tp, uint32_t time)
 static int
 tp_post_scroll_events(struct tp_dispatch *tp, uint32_t time)
 {
+	struct tp_touch *t;
+	int nfingers_down = 0;
+
 	/* don't scroll if a clickpad is held down */
 	if (tp->buttons.is_clickpad &&
 	    (tp->buttons.state || tp->buttons.old_state))
 		return 0;
 
-	if (tp->nfingers_down != 2) {
+	/* Only count active touches for 2 finger scrolling */
+	tp_for_each_touch(tp, t) {
+		if (tp_touch_active(tp, t))
+			nfingers_down++;
+	}
+
+	if (nfingers_down != 2) {
 		/* terminate scrolling with a zero scroll event to notify
 		 * caller that it really ended now */
 		if (tp->scroll.state != SCROLL_STATE_NONE) {
-- 
1.9.0



More information about the wayland-devel mailing list