summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2018-03-12 14:32:39 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2018-03-14 10:17:32 +1000
commit204820e4dee21f074463c99c38092e49d8aa44a0 (patch)
tree2c4981116e5c4b9576172b92be70dda92ca88f92
parent42e8813a632699e55f8287430f458ae6f5312146 (diff)
touchpad: make sure we compare only the last 3 events for wobble
We're left-shifting the bits but weren't comparing against the l_r_l mask itself. So if we get a sequence of [1, 1, 0, 1] we didn't detect a wobble because 0b1101 != 0b101 (what we're looking for). Fix this by turning it into a right shift, that way the bits fall off the mask automatic al ly y y y y . . _._v.___ Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit 5883ac7d98614e735e44767f3fef0e2ca03ad1ee)
-rw-r--r--src/evdev-mt-touchpad.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index 4ebadc25..a3d69a19 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -178,11 +178,12 @@ tp_detect_wobbling(struct tp_dispatch *tp,
return;
}
- t->hysteresis.x_motion_history <<= 1;
+ t->hysteresis.x_motion_history >>= 1;
if (dx > 0) { /* right move */
static const char r_l_r = 0x5; /* {Right, Left, Right} */
- t->hysteresis.x_motion_history |= 0x1;
+
+ t->hysteresis.x_motion_history |= (1 << 2);
if (t->hysteresis.x_motion_history == r_l_r) {
tp->hysteresis.enabled = true;
evdev_log_debug(tp->device, "hysteresis enabled\n");