From 2e8403e7628fe87b7689d82efe61cf6465c6af12 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Tue, 17 Feb 2015 11:40:57 +0100 Subject: [PATCH] touchpad: Do not use fake touches when getting the average touches delta Only look at real touches when getting the average touches delta, otherwise the touch used to populate the fake touches gets an unfair weighing factor. Signed-off-by: Hans de Goede Reviewed-by: Peter Hutterer --- src/evdev-mt-touchpad-gestures.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c index 3a013f5a..71a81ca6 100644 --- a/src/evdev-mt-touchpad-gestures.c +++ b/src/evdev-mt-touchpad-gestures.c @@ -35,13 +35,15 @@ static void tp_get_average_touches_delta(struct tp_dispatch *tp, double *dx, double *dy) { struct tp_touch *t; - int nchanged = 0; + unsigned int i, nchanged = 0; double tmpx, tmpy; *dx = 0.0; *dy = 0.0; - tp_for_each_touch(tp, t) { + for (i = 0; i < tp->real_touches; i++) { + t = &tp->touches[i]; + if (tp_touch_active(tp, t) && t->dirty) { nchanged++; tp_get_delta(t, &tmpx, &tmpy);