From 117ef6508710b98f89d7072a63f0daca6899495b Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 19 Jun 2019 12:04:23 +1000 Subject: [PATCH] touchpad: add helper function to reset a thumb's state Extracted from Matt Mayfield's thumb detection patches. Signed-off-by: Peter Hutterer --- src/evdev-mt-touchpad-thumb.c | 6 ++++++ src/evdev-mt-touchpad.c | 2 +- src/evdev-mt-touchpad.h | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/evdev-mt-touchpad-thumb.c b/src/evdev-mt-touchpad-thumb.c index 4d9b6f26..bfa5256c 100644 --- a/src/evdev-mt-touchpad-thumb.c +++ b/src/evdev-mt-touchpad-thumb.c @@ -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) { diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index 349f730d..e9716381 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -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; diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h index 12a6b03f..61422a5e 100644 --- a/src/evdev-mt-touchpad.h +++ b/src/evdev-mt-touchpad.h @@ -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);