[PATCH libinput 4/5] touchpad: don't end below-threshold pressure touches if nfake_fingers > nslots

Peter Hutterer peter.hutterer at who-t.net
Thu Mar 1 02:25:46 UTC 2018


If we have more BTN_TOOL_*TAP fingers down than we have slots, ignore any
below-threshold pressure changes on the slots. When a touchpad only detects
two touches, guessing whether the third touch has sufficient pressure is
unreliable. Instead, always assume that all touches have sufficient pressure
when we exceed the slot number.

Exception: if all real fingers are below the pressure threshold, the fake
fingers are ignored too.

Related to https://bugs.freedesktop.org/show_bug.cgi?id=105258

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/evdev-mt-touchpad.c  |  4 +++-
 test/test-touchpad-tap.c | 11 ++++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index eaa9215a..f9bec925 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -1103,7 +1103,9 @@ tp_unhover_pressure(struct tp_dispatch *tp, uint64_t time)
 					tp_motion_history_reset(t);
 					tp_begin_touch(tp, t, time);
 				}
-			} else {
+			/* don't unhover for pressure if we have too many
+			 * fake fingers down, see comment below */
+			} else if (nfake_touches <= tp->num_slots) {
 				if (t->pressure < tp->pressure.low) {
 					evdev_log_debug(tp->device,
 							"pressure: end touch %d\n",
diff --git a/test/test-touchpad-tap.c b/test/test-touchpad-tap.c
index 948be965..aa1ea0f5 100644
--- a/test/test-touchpad-tap.c
+++ b/test/test-touchpad-tap.c
@@ -1632,10 +1632,19 @@ START_TEST(touchpad_3fg_tap_pressure_btntool)
 	litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1);
 	litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0);
 	litest_pop_event_frame(dev);
-	litest_assert_empty_queue(li);
 
 	litest_touch_up(dev, 0);
 	litest_touch_up(dev, 1);
+	libinput_dispatch(li);
+	litest_timeout_tap();
+	libinput_dispatch(li);
+
+	litest_assert_button_event(li,
+				   BTN_MIDDLE,
+				   LIBINPUT_BUTTON_STATE_PRESSED);
+	litest_assert_button_event(li,
+				   BTN_MIDDLE,
+				   LIBINPUT_BUTTON_STATE_RELEASED);
 }
 END_TEST
 
-- 
2.14.3



More information about the wayland-devel mailing list