summaryrefslogtreecommitdiff
path: root/src/grail-gestures.c
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2011-02-24 23:38:01 +0100
committerHenrik Rydberg <rydberg@euromail.se>2011-03-14 12:55:19 +0100
commitf92c18c344c04a2501e01ae402441a92883da382 (patch)
treefec506ca8784002083babe767505930be2a8d25a /src/grail-gestures.c
parent609e367b3ee2b587f698b65393aa22357f453add (diff)
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 <rydberg@euromail.se>
Diffstat (limited to 'src/grail-gestures.c')
-rw-r--r--src/grail-gestures.c10
1 files changed, 7 insertions, 3 deletions
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)
111 fm->sample_ms = t; 111 fm->sample_ms = t;
112 m->tickle &= ~(1 << i); 112 m->tickle &= ~(1 << i);
113 m->active &= ~(1 << i); 113 m->active &= ~(1 << i);
114 m->timeout &= ~(1 << i);
114} 115}
115 116
116static void move_update(struct move_model *m, int i, float x, grail_time_t t) 117static 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)
132 if (m->active & (1 << i)) 133 if (m->active & (1 << i))
133 return; 134 return;
134 fm->action_delta = x - fm->original; 135 fm->action_delta = x - fm->original;
135 if (fabs(fm->action_delta) > fm->bar || 136 if (fabs(fm->action_delta) > fm->bar) {
136 t - fm->original_ms > fm->bar_ms)
137 m->active |= (1 << i); 137 m->active |= (1 << i);
138 else 138 } else if (t - fm->original_ms > fm->bar_ms) {
139 m->active |= (1 << i);
140 m->timeout |= (1 << i);
141 } else {
139 fm->action_delta = 0; 142 fm->action_delta = 0;
143 }
140} 144}
141 145
142void gru_init_motion(struct grail *ge) 146void gru_init_motion(struct grail *ge)