touchpad: don't end below-threshold pressure touches if nfake_fingers > nslots

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@who-t.net>
This commit is contained in:
Peter Hutterer 2018-02-28 11:38:12 +10:00
parent 85e5d80cd4
commit 3979b9e16a
2 changed files with 13 additions and 2 deletions

View file

@ -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",

View file

@ -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