From 5d1af9d38205e0675ef1cf2a37c7af4b66e5b429 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 30 Jul 2015 13:53:39 +1000 Subject: [PATCH] Fix broken 2fg scrolling on single-touch touchpads (#1246651) - Drop distance threshold for 2fg gesture detection (#1246868) --- ...distance-threshold-to-detect-pinches.patch | 59 +++++++++++++++++++ ...touches-not-just-num_slots-for-the-n.patch | 32 ++++++++++ libinput.spec | 9 ++- 3 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 0001-touchpad-drop-distance-threshold-to-detect-pinches.patch create mode 100644 0002-gestures-check-ntouches-not-just-num_slots-for-the-n.patch diff --git a/0001-touchpad-drop-distance-threshold-to-detect-pinches.patch b/0001-touchpad-drop-distance-threshold-to-detect-pinches.patch new file mode 100644 index 0000000..37aa8e7 --- /dev/null +++ b/0001-touchpad-drop-distance-threshold-to-detect-pinches.patch @@ -0,0 +1,59 @@ +From 6b59b4273c38570258519d16357dd0953b650bc8 Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Tue, 28 Jul 2015 12:54:16 +1000 +Subject: [PATCH libinput] touchpad: drop distance threshold to detect pinches + +This gives us too many false positives of 2fg scroll being detected as pinch +gesture. Reporter in [1] uses index+ring finger and thus exceeds the distance +easily (that's admittedly a special case). + +This is worsed by the lack of a client stack that handles the gestures. User's +don't see that they're inadvertently performing a gesture, they just see 2fg +scroll not working. + +Drop the distance for now, once we have a ubiquitous client stack we can +revisit and bring it back. + +[1] https://bugzilla.redhat.com/show_bug.cgi?id=1246868 + +Signed-off-by: Peter Hutterer +Reviewed-by: Hans de Goede +--- + src/evdev-mt-touchpad-gestures.c | 17 +---------------- + 1 file changed, 1 insertion(+), 16 deletions(-) + +diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c +index 6b1a273..3b1839e 100644 +--- a/src/evdev-mt-touchpad-gestures.c ++++ b/src/evdev-mt-touchpad-gestures.c +@@ -264,26 +264,11 @@ tp_gesture_twofinger_handle_state_none(struct tp_dispatch *tp, uint64_t time) + static enum tp_gesture_2fg_state + tp_gesture_twofinger_handle_state_unknown(struct tp_dispatch *tp, uint64_t time) + { +- struct normalized_coords normalized; +- struct device_float_coords delta; + struct tp_touch *first = tp->gesture.touches[0], + *second = tp->gesture.touches[1]; + int dir1, dir2; + +- delta = device_delta(first->point, second->point); +- normalized = tp_normalize_delta(tp, delta); +- +- /* If fingers are further than 3 cm apart assume pinch */ +- if (normalized_length(normalized) > TP_MM_TO_DPI_NORMALIZED(30)) { +- tp_gesture_get_pinch_info(tp, +- &tp->gesture.initial_distance, +- &tp->gesture.angle, +- &tp->gesture.center); +- tp->gesture.prev_scale = 1.0; +- return GESTURE_2FG_STATE_PINCH; +- } +- +- /* Elif fingers have been close together for a while, scroll */ ++ /* if fingers stay unmoving for a while, assume (slow) scroll */ + if (time > (tp->gesture.initial_time + DEFAULT_GESTURE_2FG_SCROLL_TIMEOUT)) { + tp_gesture_set_scroll_buildup(tp); + return GESTURE_2FG_STATE_SCROLL; +-- +2.4.3 + diff --git a/0002-gestures-check-ntouches-not-just-num_slots-for-the-n.patch b/0002-gestures-check-ntouches-not-just-num_slots-for-the-n.patch new file mode 100644 index 0000000..b00fa0b --- /dev/null +++ b/0002-gestures-check-ntouches-not-just-num_slots-for-the-n.patch @@ -0,0 +1,32 @@ +From c24a69a0db8cc18e580cc813b91fae6aff9bb74a Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Wed, 29 Jul 2015 17:12:53 +1000 +Subject: [PATCH libinput] gestures: check ntouches, not just num_slots for the + number of fingers + +We need to check fake fingers as well as real fingers, especially for +two-finger scrolling on single-touch touchpads with BTN_TOOL_DOUBLETAP. + +https://bugzilla.redhat.com/show_bug.cgi?id=1246651 + +Signed-off-by: Peter Hutterer +--- + src/evdev-mt-touchpad-gestures.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c +index 8bcdeb4..6b1a273 100644 +--- a/src/evdev-mt-touchpad-gestures.c ++++ b/src/evdev-mt-touchpad-gestures.c +@@ -157,7 +157,7 @@ tp_gesture_get_active_touches(struct tp_dispatch *tp, + + memset(touches, 0, count * sizeof(struct tp_touch *)); + +- for (i = 0; i < tp->num_slots; i++) { ++ for (i = 0; i < tp->ntouches; i++) { + t = &tp->touches[i]; + if (tp_touch_active(tp, t)) { + touches[n++] = t; +-- +2.4.3 + diff --git a/libinput.spec b/libinput.spec index fa93486..2eb7839 100644 --- a/libinput.spec +++ b/libinput.spec @@ -5,7 +5,7 @@ Name: libinput Version: 0.20.0 -Release: 5%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist} +Release: 6%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist} Summary: Input device library License: MIT @@ -30,6 +30,9 @@ Patch10: 0003-Tag-synaptics-serial-touchpads-with-a-LIBINPUT_MODEL.patch Patch11: 0004-touchpad-disable-2fg-scrolling-on-Synaptics-semi-mt-.patch # Bug 1246651 - two-finger scroll stopped working with upgrade to 0.20.0-1 Patch12: 0001-udev-add-size-hint-for-appletouch-one-button-touchpa.patch +Patch13: 0002-gestures-check-ntouches-not-just-num_slots-for-the-n.patch +# Bug 1246868 Two finger scrolling does not work with first and fourth fingers (cf. Synaptics driver) +Patch14: 0001-touchpad-drop-distance-threshold-to-detect-pinches.patch BuildRequires: git BuildRequires: autoconf automake libtool pkgconfig @@ -107,6 +110,10 @@ find $RPM_BUILD_ROOT -name '*.la' -delete %changelog +* Thu Jul 30 2015 Peter Hutterer 0.20.0-6 +- Fix broken 2fg scrolling on single-touch touchpads (#1246651) +- Drop distance threshold for 2fg gesture detection (#1246868) + * Wed Jul 29 2015 Peter Hutterer 0.20.0-5 - Add a size hint for Apple one-button touchpads (#1246651)