[PATCH libinput] touchpad: increase drag timeout

Peter Hutterer peter.hutterer at who-t.net
Fri May 1 01:15:00 PDT 2015


From: Velimir Lisec <lisec.velimir at gmail.com>

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 <lisec.velimir at gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 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 50e1512..70c45ff 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 {
@@ -129,6 +130,12 @@ tp_tap_set_timer(struct tp_dispatch *tp, uint64_t time)
 }
 
 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)
 {
 	libinput_timer_cancel(&tp->tap.timer);
@@ -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.3.5



More information about the wayland-devel mailing list