touchpad: add helper function to reset a thumb's state
authorPeter Hutterer <peter.hutterer@who-t.net>
Wed, 19 Jun 2019 02:04:23 +0000 (12:04 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Mon, 15 Jul 2019 03:08:47 +0000 (13:08 +1000)
Extracted from Matt Mayfield's thumb detection patches.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
src/evdev-mt-touchpad-thumb.c
src/evdev-mt-touchpad.c
src/evdev-mt-touchpad.h

index 4d9b6f2..bfa5256 100644 (file)
@@ -63,6 +63,12 @@ tp_thumb_set_state(struct tp_dispatch *tp,
 }
 
 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)
 {
        /* once a thumb, always a thumb, once ruled out always ruled out */
index 349f730..e971638 100644 (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;
index 12a6b03..61422a5 100644 (file)
@@ -685,6 +685,9 @@ 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);
 
 void