summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2011-03-25 19:20:08 +0100
committerHenrik Rydberg <rydberg@euromail.se>2011-03-28 22:02:11 +0200
commit9a99564617a6c308bc2fc352726581dae0515195 (patch)
tree7542958dc57528ad17d6331344b9f3c776386719
parent5d7ec311cdef842e60756d9189d09e3814e4ad1d (diff)
Do not timeout gestures overlapping touch gestures
The notion of listening to touch gestures implies that the touches of those gestures never timeout. Hence, any pending gesture that overlaps those touches should not timeout. Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
-rw-r--r--src/grail-inserter.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/grail-inserter.c b/src/grail-inserter.c
index 5225cb8..fc9076a 100644
--- a/src/grail-inserter.c
+++ b/src/grail-inserter.c
@@ -38,6 +38,18 @@ static int find_gslot(const struct gesture_inserter *gin, int gid)
38 return -1; 38 return -1;
39} 39}
40 40
41static int mask_overlap(const grail_mask_t *a, const grail_mask_t *b,
42 int bytes)
43{
44 int i;
45
46 for (i = 0; i < bytes; i++)
47 if (a[i] & b[i])
48 return 1;
49
50 return 0;
51}
52
41// todo: spanning tree for multi-user case 53// todo: spanning tree for multi-user case
42static void setup_new_gestures(struct grail *ge, 54static void setup_new_gestures(struct grail *ge,
43 const struct utouch_frame *frame) 55 const struct utouch_frame *frame)
@@ -119,8 +131,10 @@ void gin_frame_begin(struct grail *ge, const struct utouch_frame *frame)
119void gin_frame_end(struct grail *ge, const struct utouch_frame *frame) 131void gin_frame_end(struct grail *ge, const struct utouch_frame *frame)
120{ 132{
121 struct gesture_inserter *gin = ge->gin; 133 struct gesture_inserter *gin = ge->gin;
134 grail_mask_t keep[DIM_TOUCH_BYTES];
122 int i, hold[2] = { 0, 0 }, discard[2] = { 0, 0 }; 135 int i, hold[2] = { 0, 0 }, discard[2] = { 0, 0 };
123 136
137 memset(keep, 0, sizeof(keep));
124 setup_new_gestures(ge, frame); 138 setup_new_gestures(ge, frame);
125 139
126 grail_mask_foreach(i, gin->used, sizeof(gin->used)) { 140 grail_mask_foreach(i, gin->used, sizeof(gin->used)) {
@@ -143,8 +157,16 @@ void gin_frame_end(struct grail *ge, const struct utouch_frame *frame)
143 157
144 grail_mask_foreach(i, gin->used, sizeof(gin->used)) { 158 grail_mask_foreach(i, gin->used, sizeof(gin->used)) {
145 struct slot_state *s = &gin->state[i]; 159 struct slot_state *s = &gin->state[i];
160 if (s->slice == 1)
161 grail_mask_set_mask(keep, s->span, sizeof(keep));
162 }
163
164 grail_mask_foreach(i, gin->used, sizeof(gin->used)) {
165 struct slot_state *s = &gin->state[i];
146 if (!s->timeout) 166 if (!s->timeout)
147 continue; 167 continue;
168 if (mask_overlap(keep, s->span, sizeof(keep)))
169 continue;
148 gin_gid_discard(ge, s->id); 170 gin_gid_discard(ge, s->id);
149 } 171 }
150 172