From f50f824f0e32aaa60ebf30fe66a002182c26c8a4 Mon Sep 17 00:00:00 2001 From: Arturo Castro Date: Sun, 11 Apr 2010 11:06:24 +0200 Subject: Drop movement during gesture decay With this patch, finger motion is divided into two phases; one attack phase where fingers are added to the trackpad, and one decay phase, where fingers leave the trackpad. The decay delay is set considerably larger than the attack delay. The prime effect is to ignore accidental pointer movement right after a two-finger scroll. Signed-off-by: Arturo Castro Signed-off-by: Henrik Rydberg --- src/gestures.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/gestures.c') diff --git a/src/gestures.c b/src/gestures.c index 44b9613..fb81576 100644 --- a/src/gestures.c +++ b/src/gestures.c @@ -26,7 +26,8 @@ #include "gestures.h" /* timer for cursor stability on finger touch/release */ -static const int AFTER_FINGER_CHANGE_MS = 70; +static const int FINGER_ATTACK_MS = 70; +static const int FINGER_DECAY_MS = 120; static void extract_movement(struct Gestures *gs, struct MTouch* mt) { @@ -51,7 +52,11 @@ static void extract_movement(struct Gestures *gs, struct MTouch* mt) y /= mt->state.nfinger; if (!same_fingers) { - mt->mem.move_time = mt->state.evtime + AFTER_FINGER_CHANGE_MS; + mt->mem.move_time = mt->state.evtime; + if (mt->state.nfinger > mt->prev_state.nfinger) + mt->mem.move_time += FINGER_ATTACK_MS; + else + mt->mem.move_time += FINGER_DECAY_MS; } else if (mt->state.evtime >= mt->mem.move_time) { gs->dx = x - mt->mem.move_x; gs->dy = y - mt->mem.move_y; -- cgit v1.2.3