[PATCH libinput 1/4] touchpad: reset the wobble detection history for y-only changes

Peter Hutterer peter.hutterer at who-t.net
Mon Apr 30 05:33:02 UTC 2018


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 <peter.hutterer at who-t.net>
---
 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 c56838df..dc2ed8dc 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;
 	}
-- 
2.14.3



More information about the wayland-devel mailing list