From f92c18c344c04a2501e01ae402441a92883da382 Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Thu, 24 Feb 2011 23:38:01 +0100 Subject: Introduce gesture timeouts The timeout of a gesture is integral to the gesture type. This patch introduces timeout per gesture type, potentially enabling more control over gesture timing aspects. The timeout logic replaces the recently added recognition state. Signed-off-by: Henrik Rydberg --- src/grail-gestures.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/grail-gestures.c') diff --git a/src/grail-gestures.c b/src/grail-gestures.c index 035a199..efadde5 100644 --- a/src/grail-gestures.c +++ b/src/grail-gestures.c @@ -111,6 +111,7 @@ static void move_reset(struct move_model *m, int i, float x, grail_time_t t) fm->sample_ms = t; m->tickle &= ~(1 << i); m->active &= ~(1 << i); + m->timeout &= ~(1 << i); } static void move_update(struct move_model *m, int i, float x, grail_time_t t) @@ -132,11 +133,14 @@ static void move_update(struct move_model *m, int i, float x, grail_time_t t) if (m->active & (1 << i)) return; fm->action_delta = x - fm->original; - if (fabs(fm->action_delta) > fm->bar || - t - fm->original_ms > fm->bar_ms) + if (fabs(fm->action_delta) > fm->bar) { m->active |= (1 << i); - else + } else if (t - fm->original_ms > fm->bar_ms) { + m->active |= (1 << i); + m->timeout |= (1 << i); + } else { fm->action_delta = 0; + } } void gru_init_motion(struct grail *ge) -- cgit v1.2.3