From fc51daff73960d96d5500c54d1223f4ffc47a6c1 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 5 Jun 2014 16:22:52 +1000 Subject: [PATCH] touchpad: always call into the the tap state machine A button event consumed by the softbutton or clickpad code does not feed into the tap state machine, leaving it in its current state. The touch generating that event however may have triggered state changes. For some tap/click combinations this gives us either double press/release events or an inconsistent order of events. Those issues include: * a really short physical click causes a click + tap-click * a really short physical click on the right software button causes a right click + left tap-click * tap + click causes double button left press events To avoid these, notify the tap code that a button event has occured and process that accordingly. Depending on the state this may either continue to the DEAD state or release the current tap button and then go to the DEAD state. Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede --- src/evdev-mt-touchpad.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index 8b502b78..0294eb2b 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -545,13 +545,12 @@ tp_post_events(struct tp_dispatch *tp, uint64_t time) { struct tp_touch *t = tp_current_touch(tp); double dx, dy; + int consumed = 0; - if (tp_post_button_events(tp, time) != 0) { - tp_stop_scroll_events(tp, time); - return; - } + consumed |= tp_tap_handle_state(tp, time); + consumed |= tp_post_button_events(tp, time); - if (tp_tap_handle_state(tp, time) != 0) { + if (consumed) { tp_stop_scroll_events(tp, time); return; }