From ff132b2cfbb6edb407f80c4bd238dc75eb97c7f1 Mon Sep 17 00:00:00 2001 From: Velimir Lisec Date: Thu, 30 Apr 2015 11:12:26 +0200 Subject: [PATCH] touchpad: increase drag timeout libinput supports lifting a finger during dragging and setting it back down again to continue the drag. Curently the drag timeout is set to DEFAULT_TAP_TIMEOUT. That is to short, when we're dragging the finger needs to have enough time to move from one edge of the touchpad to the other. 180ms is too short for that and causes false timeouts and thus button releases that cancel the drag. Introduce DEFAULT_DRAG_TIMEOUT and set it to 500 ms. Signed-off-by: Velimir Lisec Reviewed-by: Peter Hutterer Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede --- src/evdev-mt-touchpad-tap.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/evdev-mt-touchpad-tap.c b/src/evdev-mt-touchpad-tap.c index 50e15129..70c45ff3 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_DRAG_TIMEOUT_PERIOD 500 #define DEFAULT_TAP_MOVE_THRESHOLD TP_MM_TO_DPI_NORMALIZED(3) enum tap_event { @@ -128,6 +129,12 @@ tp_tap_set_timer(struct tp_dispatch *tp, uint64_t time) libinput_timer_set(&tp->tap.timer, time + DEFAULT_TAP_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); +} + static void tp_tap_clear_timer(struct tp_dispatch *tp) { @@ -380,7 +387,7 @@ tp_tap_dragging_handle_event(struct tp_dispatch *tp, break; case TAP_EVENT_RELEASE: tp->tap.state = TAP_STATE_DRAGGING_WAIT; - tp_tap_set_timer(tp, time); + tp_tap_set_drag_timer(tp, time); break; case TAP_EVENT_MOTION: case TAP_EVENT_TIMEOUT: -- 2.34.1