diff --git a/src/evdev-mt-touchpad-tap.c b/src/evdev-mt-touchpad-tap.c index b2894e08..1fa1271b 100644 --- a/src/evdev-mt-touchpad-tap.c +++ b/src/evdev-mt-touchpad-tap.c @@ -546,6 +546,9 @@ tp_tap_handle_state(struct tp_dispatch *tp, uint64_t time) struct tp_touch *t; int filter_motion = 0; + if (tp->tap.suspended) + return 0; + /* Handle queued button pressed events from clickpads. For touchpads * with separate physical buttons, ignore button pressed events so they * don't interfere with tapping. */ @@ -712,3 +715,18 @@ tp_release_all_taps(struct tp_dispatch *tp, uint64_t now) tp->tap.state = tp->nfingers_down ? TAP_STATE_DEAD : TAP_STATE_IDLE; } + +void +tp_tap_suspend(struct tp_dispatch *tp, uint64_t time) +{ + tp->tap.suspended = true; + tp_release_all_taps(tp, time); +} + +void +tp_tap_resume(struct tp_dispatch *tp, uint64_t time) +{ + tp->tap.suspended = false; + /* Must restart in DEAD if fingers are down atm */ + tp->tap.state = tp->nfingers_down ? TAP_STATE_DEAD : TAP_STATE_IDLE; +} diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h index 30bc2f6f..cc04dc9c 100644 --- a/src/evdev-mt-touchpad.h +++ b/src/evdev-mt-touchpad.h @@ -211,6 +211,7 @@ struct tp_dispatch { struct { struct libinput_device_config_tap config; bool enabled; + bool suspended; struct libinput_timer timer; enum tp_tap_state state; uint32_t buttons_pressed; @@ -281,4 +282,10 @@ void tp_release_all_taps(struct tp_dispatch *tp, uint64_t time); +void +tp_tap_suspend(struct tp_dispatch *tp, uint64_t time); + +void +tp_tap_resume(struct tp_dispatch *tp, uint64_t time); + #endif