From 282979558eecd83c2a6c50d6a744b789d5f5fdff Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 21 Jun 2019 11:26:11 +1000 Subject: [PATCH] touchpad: add a helper function for supressing a thumb Only sets the state to YES at the moment, will do more in the future. Signed-off-by: Peter Hutterer --- src/evdev-mt-touchpad-gestures.c | 2 +- src/evdev-mt-touchpad-thumb.c | 8 +++++++- src/evdev-mt-touchpad.h | 3 +++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c index 47d14177..7d4a13f9 100644 --- a/src/evdev-mt-touchpad-gestures.c +++ b/src/evdev-mt-touchpad-gestures.c @@ -535,7 +535,7 @@ tp_gesture_handle_state_unknown(struct tp_dispatch *tp, uint64_t time) * more thumb motion on >2 finger gestures during detection. */ if (tp->thumb.detect_thumbs && thumb_mm < inner) { - tp_thumb_set_state(tp, thumb, THUMB_STATE_YES); + tp_thumb_suppress(tp, thumb); return GESTURE_STATE_NONE; } diff --git a/src/evdev-mt-touchpad-thumb.c b/src/evdev-mt-touchpad-thumb.c index c45a0670..41e6f41c 100644 --- a/src/evdev-mt-touchpad-thumb.c +++ b/src/evdev-mt-touchpad-thumb.c @@ -101,6 +101,12 @@ tp_thumb_detect_pressure_size(const struct tp_dispatch *tp, return is_thumb; } +void +tp_thumb_suppress(struct tp_dispatch *tp, struct tp_touch *t) +{ + tp_thumb_set_state(tp, t, THUMB_STATE_YES); +} + void tp_thumb_update_touch(struct tp_dispatch *tp, struct tp_touch *t, @@ -222,7 +228,7 @@ tp_thumb_update_multifinger(struct tp_dispatch *tp) evdev_log_debug(tp->device, "touch %d is speed-based thumb\n", second->index); - tp_thumb_set_state(tp, second, THUMB_STATE_YES); + tp_thumb_suppress(tp, second); } void diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h index 8845c8cd..ef1265b1 100644 --- a/src/evdev-mt-touchpad.h +++ b/src/evdev-mt-touchpad.h @@ -687,6 +687,9 @@ 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_suppress(struct tp_dispatch *tp, struct tp_touch *t); + void tp_thumb_update_touch(struct tp_dispatch *tp, struct tp_touch *t,