summaryrefslogtreecommitdiff
path: root/src/grail-gestures.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/grail-gestures.c')
-rw-r--r--src/grail-gestures.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/grail-gestures.c b/src/grail-gestures.c
index f1e2093..33d848c 100644
--- a/src/grail-gestures.c
+++ b/src/grail-gestures.c
@@ -218,3 +218,27 @@ void gru_end(struct grail *ge, int gid, const struct move_model *m,
218 prop, nprop); 218 prop, nprop);
219} 219}
220 220
221void gru_compute_bbox(struct grail_coord *min, struct grail_coord *max,
222 const struct touch_frame *frame)
223{
224 float x, y;
225 int i;
226 if (frame->nactive < 1)
227 return;
228 x = frame->active[0]->prop[TP_POS_X];
229 y = frame->active[0]->prop[TP_POS_Y];
230 min->x = max->x = x;
231 min->y = max->y = y;
232 for (i = 1; i < frame->nactive; i++) {
233 x = frame->active[i]->prop[TP_POS_X];
234 y = frame->active[i]->prop[TP_POS_Y];
235 if (x < min->x)
236 min->x = x;
237 if (y < min->y)
238 min->y = y;
239 if (x > max->x)
240 max->x = x;
241 if (y > max->y)
242 max->y = y;
243 }
244}