touchpad: add helper function to reset a thumb's state

Extracted from Matt Mayfield's thumb detection patches.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2019-06-19 12:04:23 +10:00
parent c2331ae11e
commit 117ef65087
3 changed files with 10 additions and 1 deletions

View file

@ -62,6 +62,12 @@ tp_thumb_set_state(struct tp_dispatch *tp,
t->thumb.state = state;
}
void
tp_thumb_reset(struct tp_dispatch *tp, struct tp_touch *t)
{
t->thumb.state = THUMB_STATE_MAYBE;
}
void
tp_thumb_detect(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
{

View file

@ -353,7 +353,7 @@ tp_begin_touch(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
t->was_down = true;
tp->nfingers_down++;
t->palm.time = time;
t->thumb.state = THUMB_STATE_MAYBE;
tp_thumb_reset(tp, t);
t->thumb.first_touch_time = time;
t->tap.is_thumb = false;
t->tap.is_palm = false;

View file

@ -684,6 +684,9 @@ tp_clickpad_middlebutton_apply_config(struct evdev_device *device);
bool
tp_thumb_ignored(const struct tp_dispatch *tp, const struct tp_touch *t);
void
tp_thumb_reset(struct tp_dispatch *tp, struct tp_touch *t);
void
tp_thumb_detect(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time);