From 82cf6ba128f7b09a832d9369b30646eca0bef033 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 21 Feb 2018 13:41:31 +1000 Subject: [PATCH libinput] touchpad: use the fuzz value (if any) for the hysteresis margin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We currently used 0.5mm on touchpads as hysteresis value. This causes pointer movement delays, it is likely too high. Reduce it to a kernel-set fuzz value (if any) and see how we go with that. On many touchpads, the fuzz is 8 which would be closer to 0.2mm on e.g. a T440. Note that the does some defuzzing anyway, but the response of that function is nonlinear, e.g. for a fuzz of 8, the physical deltas map to: phys 0..3 → delta 0 phys 4..7 → delta 1 phys 8..15 → delta 4, 5, 6, 7 phys 16..N → delta 16..N In other words, we never see logical deltas of 2 and 3. While this shouldn't matter given the average touchpad resolution, reducing the hysteresis margin is likely to provide some better response. https://bugs.freedesktop.org/show_bug.cgi?id=105108 --- src/evdev-mt-touchpad.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index b3ed6d56..528353a4 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -2947,12 +2947,22 @@ tp_init_default_resolution(struct tp_dispatch *tp, static inline void tp_init_hysteresis(struct tp_dispatch *tp) { - int res_x, res_y; + int xmargin, ymargin; + const struct input_absinfo *ax = tp->device->abs.absinfo_x, + *ay = tp->device->abs.absinfo_y; - res_x = tp->device->abs.absinfo_x->resolution; - res_y = tp->device->abs.absinfo_y->resolution; - tp->hysteresis.margin.x = res_x/2; - tp->hysteresis.margin.y = res_y/2; + if (ax->fuzz) + xmargin = ax->fuzz; + else + xmargin = ax->resolution/2; + + if (ay->fuzz) + ymargin = ay->fuzz; + else + ymargin = ay->resolution/2; + + tp->hysteresis.margin.x = xmargin; + tp->hysteresis.margin.y = ymargin; tp->hysteresis.enabled = true; } -- 2.14.3