From 41496b9261bed1fd99a6981e2ea0bb1b474f718d Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 22 Nov 2016 10:31:04 +1000 Subject: [PATCH] Improve responsiveness of touchpads by reducing the motion history. --- ...e-the-last-two-coordinates-for-delta.patch | 62 +++++++++++++++++++ libinput.spec | 7 ++- 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 0001-touchpad-only-use-the-last-two-coordinates-for-delta.patch diff --git a/0001-touchpad-only-use-the-last-two-coordinates-for-delta.patch b/0001-touchpad-only-use-the-last-two-coordinates-for-delta.patch new file mode 100644 index 0000000..5116234 --- /dev/null +++ b/0001-touchpad-only-use-the-last-two-coordinates-for-delta.patch @@ -0,0 +1,62 @@ +From e288c3045d0c582ee19e85cbe11529dc374d4bbf Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Mon, 21 Nov 2016 08:39:47 +1000 +Subject: [PATCH libinput] touchpad: only use the last two coordinates for + delta calculation + +Taking the last 4 points means factoring in a coordinate that may be more than +40ms in the past - or even more when the finger moves slowly and we don't get +events for a while. This makes the pointer more sluggish and slower to catch up +with what the finger is actually doing. + +We already have the motion hysteresis as a separate item to prevent jumps (and +thus adds some delay to the movement), the calculation over time doesn't +provide enough benefit to justify the sluggish pointer. + +Signed-off-by: Peter Hutterer +--- + src/evdev-mt-touchpad.c | 20 +++++--------------- + 1 file changed, 5 insertions(+), 15 deletions(-) + +diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c +index d72cb19..7b8514c 100644 +--- a/src/evdev-mt-touchpad.c ++++ b/src/evdev-mt-touchpad.c +@@ -262,29 +262,19 @@ tp_end_sequence(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time) + tp_end_touch(tp, t, time); + } + +-static double +-tp_estimate_delta(int x0, int x1, int x2, int x3) +-{ +- return (x0 + x1 - x2 - x3) / 4.0; +-} +- + struct normalized_coords + tp_get_delta(struct tp_touch *t) + { + struct device_float_coords delta; + const struct normalized_coords zero = { 0.0, 0.0 }; + +- if (t->history.count < TOUCHPAD_MIN_SAMPLES) ++ if (t->history.count <= 1) + return zero; + +- delta.x = tp_estimate_delta(tp_motion_history_offset(t, 0)->x, +- tp_motion_history_offset(t, 1)->x, +- tp_motion_history_offset(t, 2)->x, +- tp_motion_history_offset(t, 3)->x); +- delta.y = tp_estimate_delta(tp_motion_history_offset(t, 0)->y, +- tp_motion_history_offset(t, 1)->y, +- tp_motion_history_offset(t, 2)->y, +- tp_motion_history_offset(t, 3)->y); ++ delta.x = tp_motion_history_offset(t, 0)->x - ++ tp_motion_history_offset(t, 1)->x; ++ delta.y = tp_motion_history_offset(t, 0)->y - ++ tp_motion_history_offset(t, 1)->y; + + return tp_normalize_delta(t->tp, delta); + } +-- +2.9.3 + diff --git a/libinput.spec b/libinput.spec index a5ff339..8a6516d 100644 --- a/libinput.spec +++ b/libinput.spec @@ -5,7 +5,7 @@ Name: libinput Version: 1.5.1 -Release: 1%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist} +Release: 2%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist} Summary: Input device library License: MIT @@ -18,6 +18,8 @@ Source2: commitid Source0: http://www.freedesktop.org/software/libinput/libinput-%{version}.tar.xz %endif +Patch01: 0001-touchpad-only-use-the-last-two-coordinates-for-delta.patch + BuildRequires: git BuildRequires: autoconf automake libtool pkgconfig BuildRequires: libevdev-devel @@ -94,6 +96,9 @@ find $RPM_BUILD_ROOT -name '*.la' -delete %changelog +* Tue Nov 22 2016 Peter Hutterer 1.5.1-2 +- Improve responsiveness of touchpads by reducing the motion history. + * Fri Nov 11 2016 Peter Hutterer 1.5.1-1 - libinput 1.5.1