mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-04 05:50:26 +01:00
touchpad: Add tap suspend / resume
While e.g. disabling the touchpad while the trackpoint is used, we want to stop sending tap (or scroll or motion) events. We cannot use tp_clear_state at this time as that will also release any touchpad buttons pressed, breaking dragging with the trackpoint using the touchpad or clickpad buttons. Calling tp_release_all_taps() and then ensuring that we do not call tp_tap_handle_state as long as the trackpoint is in use, is enough to disable taps when the trackpoint is in use. However when the trackpoint stops being used, we cannot simply start calling tp_tap_handle_state() again, we first need to sync the tap.state to the current reality, specifically if fingers are down it must be TAP_STATE_DEAD, so that their releases do not trigger the log_bug_libinput on a release in tp_tap_idle_handle_event. Directly messing with tap.state from outside evdev-mt-touchpad-tap.c is not good, so add tp_tap_suspend and tp_tap_resume functions for this. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
7dc2ea22ed
commit
cab012eefe
2 changed files with 25 additions and 0 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue