summaryrefslogtreecommitdiff
path: root/src/grail-inserter.c
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2010-09-21 09:49:26 +0200
committerHenrik Rydberg <rydberg@euromail.se>2010-09-21 12:56:17 +0200
commitd0f7b524153d1b54128b049841f880ee78c2c529 (patch)
treed6a1fa1f3254f183c77b7222b17c4ac60df658f2 /src/grail-inserter.c
parent0e1bf39bd34062f07358dc605c0f03fa5df08356 (diff)
Simplify book-keeping of active gestures
The current frame computation returns the event types to filter, which is less useful than knowing what gesture types are active in the frame. Add the active gesture types to the frame struct and simplify usage. Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'src/grail-inserter.c')
-rw-r--r--src/grail-inserter.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/grail-inserter.c b/src/grail-inserter.c
index a54b73a..847995a 100644
--- a/src/grail-inserter.c
+++ b/src/grail-inserter.c
@@ -103,20 +103,15 @@ void gin_destroy(struct grail *ge)
103void gin_frame_begin(struct grail *ge, const struct touch_frame *frame) 103void gin_frame_begin(struct grail *ge, const struct touch_frame *frame)
104{ 104{
105 struct gesture_inserter *gin = ge->gin; 105 struct gesture_inserter *gin = ge->gin;
106 memset(gin->types, 0, sizeof(gin->types));
106 gin->time = frame->time; 107 gin->time = frame->time;
107} 108}
108 109
109void gin_frame_end(struct grail *ge, 110void gin_frame_end(struct grail *ge, const struct touch_frame *frame)
110 grail_mask_t *filtered, int max_filtered,
111 const struct touch_frame *frame)
112{ 111{
113 struct gesture_inserter *gin = ge->gin; 112 struct gesture_inserter *gin = ge->gin;
114 grail_mask_t span[DIM_INSTANCE_BYTES];
115 int i, hold = 0, discard = 0; 113 int i, hold = 0, discard = 0;
116 114
117 memset(filtered, 0, max_filtered);
118 memset(span, 0, sizeof(span));
119
120 setup_new_gestures(ge, frame); 115 setup_new_gestures(ge, frame);
121 116
122 grail_mask_foreach(i, gin->used, sizeof(gin->used)) { 117 grail_mask_foreach(i, gin->used, sizeof(gin->used)) {
@@ -140,7 +135,7 @@ void gin_frame_end(struct grail *ge,
140 grail_mask_foreach(i, gin->used, sizeof(gin->used)) { 135 grail_mask_foreach(i, gin->used, sizeof(gin->used)) {
141 struct slot_state *s = &gin->state[i]; 136 struct slot_state *s = &gin->state[i];
142 struct gesture_event ev; 137 struct gesture_event ev;
143 grail_mask_set_mask(span, s->span, sizeof(span)); 138 grail_mask_set(gin->types, s->type);
144 if (s->priority < hold) 139 if (s->priority < hold)
145 continue; 140 continue;
146 while (!gebuf_empty(&s->buf)) { 141 while (!gebuf_empty(&s->buf)) {
@@ -154,9 +149,6 @@ void gin_frame_end(struct grail *ge,
154 if (s->status == GRAIL_STATUS_END) 149 if (s->status == GRAIL_STATUS_END)
155 gin_gid_discard(ge, s->id); 150 gin_gid_discard(ge, s->id);
156 } 151 }
157
158 if (grail_mask_count(span, sizeof(span)))
159 grail_mask_set(filtered, EV_ABS);
160} 152}
161 153
162int gin_gid_begin_select(struct grail *ge, int type, int priority, 154int gin_gid_begin_select(struct grail *ge, int type, int priority,