From 148c724d0e04c427cf1ff7ab6445efeba67dcc1a Mon Sep 17 00:00:00 2001 From: Velimir Lisec Date: Thu, 30 Apr 2015 15:14:41 +0200 Subject: [PATCH 1/2] Reduce the time required for libinput to send button events after a double tap. --- src/evdev-mt-touchpad-tap.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/evdev-mt-touchpad-tap.c b/src/evdev-mt-touchpad-tap.c index 2275c5b..5398cdf 100644 --- a/src/evdev-mt-touchpad-tap.c +++ b/src/evdev-mt-touchpad-tap.c @@ -37,6 +37,7 @@ #define CASE_RETURN_STRING(a) case a: return #a #define DEFAULT_TAP_TIMEOUT_PERIOD 180 +#define DEFAULT_MULTITAP_TIMEOUT_PERIOD 150 #define DEFAULT_DRAG_TIMEOUT_PERIOD 300 #define DEFAULT_TAP_MOVE_THRESHOLD TP_MM_TO_DPI_NORMALIZED(3) @@ -131,6 +132,12 @@ tp_tap_set_timer(struct tp_dispatch *tp, uint64_t time) } static void +tp_tap_set_multitap_timer(struct tp_dispatch *tp, uint64_t time) +{ + libinput_timer_set(&tp->tap.timer, time + DEFAULT_MULTITAP_TIMEOUT_PERIOD); +} + +static void tp_tap_set_drag_timer(struct tp_dispatch *tp, uint64_t time) { libinput_timer_set(&tp->tap.timer, time + DEFAULT_DRAG_TIMEOUT_PERIOD); @@ -364,7 +371,7 @@ tp_tap_dragging_or_doubletap_handle_event(struct tp_dispatch *tp, case TAP_EVENT_RELEASE: tp->tap.state = TAP_STATE_MULTITAP; tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_RELEASED); - tp_tap_set_timer(tp, time); + tp_tap_set_multitap_timer(tp, time); break; case TAP_EVENT_MOTION: case TAP_EVENT_TIMEOUT: @@ -522,7 +529,7 @@ tp_tap_multitap_down_handle_event(struct tp_dispatch *tp, case TAP_EVENT_RELEASE: tp->tap.state = TAP_STATE_MULTITAP; tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_RELEASED); - tp_tap_set_timer(tp, time); + tp_tap_set_multitap_timer(tp, time); break; case TAP_EVENT_TOUCH: tp->tap.state = TAP_STATE_DRAGGING_2; -- 1.9.1