Ignore tap motion for 3fg taps when we only have 2 slots (#1455443)

This commit is contained in:
Peter Hutterer 2017-06-19 10:28:15 +10:00
commit d5cd7e25a7
2 changed files with 124 additions and 1 deletions

View file

@ -0,0 +1,119 @@
From 2f81e554e94c6b560ac2432a2f3e2db0f09364be Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Thu, 15 Jun 2017 14:13:26 +1000
Subject: [PATCH libinput] touchpad: ignore the tap motion threshold if fingers
> slots
Do so on the synaptics serial touchpads at least, they're known to cause
cursor jumps when the third finger is down. Not detecting a tap move means
three-finger taps get more reliable on these touchpads.
This change affects gestures who now effectively have to wait for the tap
timeout to happen. It's a trade-off.
https://bugs.freedesktop.org/show_bug.cgi?id=101435
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
src/evdev-mt-touchpad-tap.c | 12 ++++++++++
test/test-touchpad-tap.c | 54 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 66 insertions(+)
diff --git a/src/evdev-mt-touchpad-tap.c b/src/evdev-mt-touchpad-tap.c
index 03d4c701..bc1b41e9 100644
--- a/src/evdev-mt-touchpad-tap.c
+++ b/src/evdev-mt-touchpad-tap.c
@@ -730,6 +730,18 @@ tp_tap_exceeds_motion_threshold(struct tp_dispatch *tp,
tp_normalize_delta(tp, device_delta(t->point,
t->tap.initial));
+ /* if we have more fingers down than slots, we know that synaptics
+ * touchpads are likely to give us pointer jumps.
+ * This triggers the movement threshold, making three-finger taps
+ * less reliable (#101435)
+ */
+ if (tp->device->model_flags & EVDEV_MODEL_SYNAPTICS_SERIAL_TOUCHPAD &&
+ (tp->nfingers_down > 2 || tp->old_nfingers_down > 2) &&
+ (tp->nfingers_down > tp->num_slots ||
+ tp->old_nfingers_down > tp->num_slots)) {
+ return false;
+ }
+
return normalized_length(norm) > DEFAULT_TAP_MOVE_THRESHOLD;
}
diff --git a/test/test-touchpad-tap.c b/test/test-touchpad-tap.c
index 7acd0bad..3777eda2 100644
--- a/test/test-touchpad-tap.c
+++ b/test/test-touchpad-tap.c
@@ -1542,6 +1542,59 @@ START_TEST(touchpad_3fg_tap_btntool_inverted)
}
END_TEST
+START_TEST(touchpad_3fg_tap_btntool_pointerjump)
+{
+ struct litest_device *dev = litest_current_device();
+ struct libinput *li = dev->libinput;
+ enum libinput_config_tap_button_map map = _i; /* ranged test */
+ unsigned int button = 0;
+
+ if (libevdev_get_abs_maximum(dev->evdev,
+ ABS_MT_SLOT) > 2)
+ return;
+
+ litest_enable_tap(dev->libinput_device);
+ litest_set_tap_map(dev->libinput_device, map);
+
+ switch (map) {
+ case LIBINPUT_CONFIG_TAP_MAP_LRM:
+ button = BTN_MIDDLE;
+ break;
+ case LIBINPUT_CONFIG_TAP_MAP_LMR:
+ button = BTN_RIGHT;
+ break;
+ default:
+ litest_abort_msg("Invalid map range %d", map);
+ }
+
+ litest_drain_events(li);
+
+ litest_touch_down(dev, 0, 50, 50);
+ litest_touch_down(dev, 1, 70, 50);
+ litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1);
+ litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0);
+ litest_event(dev, EV_SYN, SYN_REPORT, 0);
+ /* Pointer jump should be ignored */
+ litest_touch_move_to(dev, 0, 50, 50, 20, 20, 0, 0);
+ libinput_dispatch(li);
+ litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0);
+ litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1);
+ litest_event(dev, EV_SYN, SYN_REPORT, 0);
+ litest_touch_up(dev, 1);
+ litest_touch_up(dev, 0);
+
+ libinput_dispatch(li);
+
+ litest_assert_button_event(li, button,
+ LIBINPUT_BUTTON_STATE_PRESSED);
+ litest_timeout_tap();
+ litest_assert_button_event(li, button,
+ LIBINPUT_BUTTON_STATE_RELEASED);
+
+ litest_assert_empty_queue(li);
+}
+END_TEST
+
START_TEST(touchpad_4fg_tap)
{
struct litest_device *dev = litest_current_device();
@@ -2152,6 +2205,7 @@ litest_setup_tests_touchpad_tap(void)
litest_add_ranged("tap-3fg:3fg", touchpad_3fg_tap_btntool_inverted, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &tap_map_range);
litest_add_ranged("tap-3fg:3fg", touchpad_3fg_tap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &tap_map_range);
litest_add("tap-3fg:3fg", touchpad_3fg_tap_quickrelease, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
+ litest_add_for_device("tap-3fg:3fg", touchpad_3fg_tap_btntool_pointerjump, LITEST_SYNAPTICS_TOPBUTTONPAD);
litest_add("tap-4fg:4fg", touchpad_4fg_tap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
litest_add("tap-4fg:4fg", touchpad_4fg_tap_quickrelease, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
litest_add("tap-5fg:5fg", touchpad_5fg_tap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
--
2.13.0

View file

@ -5,7 +5,7 @@
Name: libinput
Version: 1.6.3
Release: 5%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist}
Release: 6%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist}
Summary: Input device library
License: MIT
@ -23,6 +23,7 @@ Source1: 90-switch.hwdb
Patch01: 0001-evdev-allow-button-scrolling-on-the-L-R-button-with-.patch
Patch02: 0001-evdev-add-quirk-for-Logitech-Marble-Mouse.patch
Patch03: 0001-touchpad-pull-the-tap-exclusion-zone-down-to-the-ful.patch
Patch04: 0001-touchpad-ignore-the-tap-motion-threshold-if-fingers-.patch
BuildRequires: git
BuildRequires: autoconf automake libtool pkgconfig
@ -103,6 +104,9 @@ install -m 644 %{SOURCE1} ${RPM_BUILD_ROOT}%{udevdir}/hwdb.d/
%changelog
* Mon Jun 26 2017 Peter Hutterer <peter.hutterer@redhat.com> 1.6.3-6
- Ignore tap motion for 3fg taps when we only have 2 slots (#1455443)
* Mon May 22 2017 Peter Hutterer <peter.hutterer@redhat.com> 1.6.3-5
- Install a hwdb file to tag lid switches as such, this is missing from F25
systemd.