summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2019-06-19 12:04:23 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2019-07-15 13:08:47 +1000
commit117ef6508710b98f89d7072a63f0daca6899495b (patch)
tree2bb85b5309927fd3e9a484a3928edbbb84f45c18
parentc2331ae11ebc4ef19186374126d54e3bb95a9e4e (diff)
downloadlibinput-117ef6508710b98f89d7072a63f0daca6899495b.tar.gz
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>
-rw-r--r--src/evdev-mt-touchpad-thumb.c6
-rw-r--r--src/evdev-mt-touchpad.c2
-rw-r--r--src/evdev-mt-touchpad.h3
3 files changed, 10 insertions, 1 deletions
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
@@ -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 */
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
@@ -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