[PATCH libinput 09/11] touchpad: Do not use fake touches when getting the average touches delta

Hans de Goede hdegoede at redhat.com
Wed Feb 18 04:26:52 PST 2015


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 <hdegoede at redhat.com>
---
 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 250974f..8ebdf33 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);
-- 
2.1.0



More information about the wayland-devel mailing list