touchpad: count only tapping fingers for clickfinger if hold-and-tap is on

Unless there are only non-tapping fingers, of course.

For this to work, the tapping state machine needs to hold off on marking all
touches as DEAD on button down. This does not hurt because their state
becomes relevant only when the button has gone up again, which marks them as
DEAD by entering TAP_STATE_DEAD.

Signed-off-by: satrmb <10471-satrmb@users.noreply.gitlab.freedesktop.org>
This commit is contained in:
satrmb 2020-08-08 10:30:31 +02:00
parent 2ba7e42c13
commit 3b0c194f80
3 changed files with 11 additions and 2 deletions

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 350 KiB

After

Width:  |  Height:  |  Size: 349 KiB

View file

@ -1170,11 +1170,13 @@ tp_clickfinger_set_button(struct tp_dispatch *tp)
struct tp_touch *t;
struct tp_touch *first = NULL,
*second = NULL;
bool only_taps = tp->tap.hold_tap_enabled;
int32_t button_map[2][3] = {
{ BTN_LEFT, BTN_RIGHT, BTN_MIDDLE },
{ BTN_LEFT, BTN_MIDDLE, BTN_RIGHT },
};
again:
tp_for_each_touch(tp, t) {
if (t->state != TOUCH_BEGIN && t->state != TOUCH_UPDATE)
continue;
@ -1185,6 +1187,9 @@ tp_clickfinger_set_button(struct tp_dispatch *tp)
if (t->palm.state != PALM_NONE)
continue;
if (only_taps && t->tap.state != TAP_TOUCH_STATE_TOUCH)
continue;
nfingers++;
if (!first)
@ -1193,6 +1198,11 @@ tp_clickfinger_set_button(struct tp_dispatch *tp)
second = t;
}
if (only_taps && nfingers == 0) {
only_taps = false;
goto again;
}
/* Only check for finger distance when there are 2 fingers on the
* touchpad */
if (nfingers != 2)

View file

@ -2027,7 +2027,6 @@ tp_tap_handle_event(struct tp_dispatch *tp,
tp_tap_clear_timer(tp);
if ((tp->tap.state == TAP_STATE_IDLE ||
tp->tap.state == TAP_STATE_BUTTON ||
tp->tap.state == TAP_STATE_DEAD))
tp_tap_kill_all_touches(tp, NULL);
}