From be69bcef2c6ac0cd554a0c4441d4799233a9c33e Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 24 Apr 2018 10:34:21 +1000 Subject: [PATCH] touchpad: reset the wobble detection history for y-only changes Otherwise we may detect wobble despite having a series of valid y movements, e.g. the following sequence was detected as wobble: x: 1 y: 0 x: 0 y: 1 x: 0 y: 2 x: 0 y: 2 x: 0 y: 1 x: -1 y: 0 x: 1 y: 0 Avoid this by resetting the history when we get a dx == 0 event. It'll take longer for real wobble to be detected but it reduces the number of false positives. Signed-off-by: Peter Hutterer --- src/evdev-mt-touchpad.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index 963a1edc..62ed7482 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -171,10 +171,7 @@ tp_detect_wobbling(struct tp_dispatch *tp, tp->hysteresis.last_motion_time = time; t->last_point = t->point; - if (dx == 0 && dy != 0) /* ignore y-only changes */ - return; - - if (dtime > ms2us(40)) { + if ((dx == 0 && dy != 0) || dtime > ms2us(40)) { t->hysteresis.x_motion_history = 0; return; }