mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-05-08 11:19:14 +02:00
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:
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 |
|
|
@ -1170,11 +1170,13 @@ tp_clickfinger_set_button(struct tp_dispatch *tp)
|
||||||
struct tp_touch *t;
|
struct tp_touch *t;
|
||||||
struct tp_touch *first = NULL,
|
struct tp_touch *first = NULL,
|
||||||
*second = NULL;
|
*second = NULL;
|
||||||
|
bool only_taps = tp->tap.hold_tap_enabled;
|
||||||
int32_t button_map[2][3] = {
|
int32_t button_map[2][3] = {
|
||||||
{ BTN_LEFT, BTN_RIGHT, BTN_MIDDLE },
|
{ BTN_LEFT, BTN_RIGHT, BTN_MIDDLE },
|
||||||
{ BTN_LEFT, BTN_MIDDLE, BTN_RIGHT },
|
{ BTN_LEFT, BTN_MIDDLE, BTN_RIGHT },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
again:
|
||||||
tp_for_each_touch(tp, t) {
|
tp_for_each_touch(tp, t) {
|
||||||
if (t->state != TOUCH_BEGIN && t->state != TOUCH_UPDATE)
|
if (t->state != TOUCH_BEGIN && t->state != TOUCH_UPDATE)
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -1185,6 +1187,9 @@ tp_clickfinger_set_button(struct tp_dispatch *tp)
|
||||||
if (t->palm.state != PALM_NONE)
|
if (t->palm.state != PALM_NONE)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (only_taps && t->tap.state != TAP_TOUCH_STATE_TOUCH)
|
||||||
|
continue;
|
||||||
|
|
||||||
nfingers++;
|
nfingers++;
|
||||||
|
|
||||||
if (!first)
|
if (!first)
|
||||||
|
|
@ -1193,6 +1198,11 @@ tp_clickfinger_set_button(struct tp_dispatch *tp)
|
||||||
second = t;
|
second = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (only_taps && nfingers == 0) {
|
||||||
|
only_taps = false;
|
||||||
|
goto again;
|
||||||
|
}
|
||||||
|
|
||||||
/* Only check for finger distance when there are 2 fingers on the
|
/* Only check for finger distance when there are 2 fingers on the
|
||||||
* touchpad */
|
* touchpad */
|
||||||
if (nfingers != 2)
|
if (nfingers != 2)
|
||||||
|
|
|
||||||
|
|
@ -2027,7 +2027,6 @@ tp_tap_handle_event(struct tp_dispatch *tp,
|
||||||
tp_tap_clear_timer(tp);
|
tp_tap_clear_timer(tp);
|
||||||
|
|
||||||
if ((tp->tap.state == TAP_STATE_IDLE ||
|
if ((tp->tap.state == TAP_STATE_IDLE ||
|
||||||
tp->tap.state == TAP_STATE_BUTTON ||
|
|
||||||
tp->tap.state == TAP_STATE_DEAD))
|
tp->tap.state == TAP_STATE_DEAD))
|
||||||
tp_tap_kill_all_touches(tp, NULL);
|
tp_tap_kill_all_touches(tp, NULL);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue