From a704984e03d28b4be40e12c43be1b163bc9e09e2 Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Thu, 19 Aug 2010 20:03:15 +0200 Subject: Simplify touch machinery To be able to model touch information uniformly across all supported devices, the semantics of the touch attributes has to be treated explicitly. Drop the generic touch property array and replace it by an actual structure. In addition, the touch-engine abstraction turned out to not be needed, so drop it as well. Signed-off-by: Henrik Rydberg --- src/grail-gestures.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/grail-gestures.c') diff --git a/src/grail-gestures.c b/src/grail-gestures.c index 33d848c..95c1b57 100644 --- a/src/grail-gestures.c +++ b/src/grail-gestures.c @@ -39,8 +39,8 @@ static void compute_position(float *x, float *y, return; for (i = 0; i < n; i++) { const struct touch *t = frame->active[i]; - *x += t->prop[TP_POS_X]; - *y += t->prop[TP_POS_Y]; + *x += t->x; + *y += t->y; } *x /= n; *y /= n; @@ -55,8 +55,8 @@ static float compute_radius(float x, float y, return r; for (i = 0; i < n; i++) { const struct touch *t = frame->active[i]; - float dx = t->prop[TP_POS_X] - x; - float dy = t->prop[TP_POS_Y] - y; + float dx = t->x - x; + float dy = t->y - y; r2 += dx * dx + dy * dy; } r2 /= n; @@ -75,10 +75,10 @@ static float compute_rotation(float x, float y, float r, for (i = 0; i < n; i++) { const struct touch *t = frame->active[i]; const struct touch *ot = &prev->touch[t->slot]; - float dx = t->prop[TP_POS_X] - x; - float dy = t->prop[TP_POS_Y] - y; - float mx = t->prop[TP_POS_X] - ot->prop[TP_POS_X]; - float my = t->prop[TP_POS_Y] - ot->prop[TP_POS_Y]; + float dx = t->x - x; + float dy = t->y - y; + float mx = t->x - ot->x; + float my = t->y - ot->y; darc2 += dx * my - dy * mx; } darc2 /= n; @@ -225,13 +225,13 @@ void gru_compute_bbox(struct grail_coord *min, struct grail_coord *max, int i; if (frame->nactive < 1) return; - x = frame->active[0]->prop[TP_POS_X]; - y = frame->active[0]->prop[TP_POS_Y]; + x = frame->active[0]->x; + y = frame->active[0]->y; min->x = max->x = x; min->y = max->y = y; for (i = 1; i < frame->nactive; i++) { - x = frame->active[i]->prop[TP_POS_X]; - y = frame->active[i]->prop[TP_POS_Y]; + x = frame->active[i]->x; + y = frame->active[i]->y; if (x < min->x) min->x = x; if (y < min->y) -- cgit v1.2.3