From c9a3c7a7e324459f2f57d17f2c334750c9f78494 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 4 May 2015 16:22:36 +1000 Subject: [PATCH] touchpad: drop the tap finger count Use tp->nfingers_down as trigger when we have no fingers left on the touchpad and when we should return to idle. If all touchpoints end in the same frame tp->nfingers is 0. Thus when we handle the first tap release we transition to IDLE which now needs to handle (and discard) any touch release events. Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede --- src/evdev-mt-touchpad-tap.c | 6 ++---- src/evdev-mt-touchpad.h | 1 - 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/evdev-mt-touchpad-tap.c b/src/evdev-mt-touchpad-tap.c index 70c45ff..61f94e5 100644 --- a/src/evdev-mt-touchpad-tap.c +++ b/src/evdev-mt-touchpad-tap.c @@ -154,6 +154,7 @@ tp_tap_idle_handle_event(struct tp_dispatch *tp, tp_tap_set_timer(tp, time); break; case TAP_EVENT_RELEASE: + break; case TAP_EVENT_MOTION: log_bug_libinput(libinput, "invalid tap event, no fingers are down\n"); @@ -531,7 +532,7 @@ tp_tap_dead_handle_event(struct tp_dispatch *tp, switch (event) { case TAP_EVENT_RELEASE: - if (tp->tap.tap_finger_count == 0) + if (tp->nfingers_down == 0) tp->tap.state = TAP_STATE_IDLE; break; case TAP_EVENT_TOUCH: @@ -652,7 +653,6 @@ tp_tap_handle_state(struct tp_dispatch *tp, uint64_t time) t->tap.state = TAP_TOUCH_STATE_DEAD; if (t->state == TOUCH_BEGIN) { - tp->tap.tap_finger_count++; t->tap.state = TAP_TOUCH_STATE_TOUCH; t->tap.initial = t->point; tp_tap_handle_event(tp, t, TAP_EVENT_TOUCH, time); @@ -665,7 +665,6 @@ tp_tap_handle_state(struct tp_dispatch *tp, uint64_t time) tp_tap_handle_event(tp, t, TAP_EVENT_MOTION, time); } else if (t->state == TOUCH_END) { - tp->tap.tap_finger_count--; tp_tap_handle_event(tp, t, TAP_EVENT_RELEASE, time); t->tap.state = TAP_TOUCH_STATE_IDLE; } else if (tp->tap.state != TAP_STATE_IDLE && @@ -850,7 +849,6 @@ tp_release_all_taps(struct tp_dispatch *tp, uint64_t now) } tp->tap.state = tp->nfingers_down ? TAP_STATE_DEAD : TAP_STATE_IDLE; - tp->tap.tap_finger_count = 0; } void diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h index 97b17cd..d4f5874 100644 --- a/src/evdev-mt-touchpad.h +++ b/src/evdev-mt-touchpad.h @@ -257,7 +257,6 @@ struct tp_dispatch { struct libinput_timer timer; enum tp_tap_state state; uint32_t buttons_pressed; - unsigned int tap_finger_count; uint64_t multitap_last_time; } tap; -- 2.7.4