diff options
| author | Henrik Rydberg <rydberg@euromail.se> | 2010-08-19 20:03:15 +0200 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@euromail.se> | 2010-08-19 20:03:15 +0200 |
| commit | a704984e03d28b4be40e12c43be1b163bc9e09e2 (patch) | |
| tree | c4720a59aa77918ffef742d7ec7ef2a7e2eda16e /src/grail-gestures.c | |
| parent | cb2cad3b8c506a08a6bdad548a10ff47f85ef38b (diff) | |
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 <rydberg@euromail.se>
Diffstat (limited to 'src/grail-gestures.c')
| -rw-r--r-- | src/grail-gestures.c | 24 |
1 files changed, 12 insertions, 12 deletions
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, | |||
| 39 | return; | 39 | return; |
| 40 | for (i = 0; i < n; i++) { | 40 | for (i = 0; i < n; i++) { |
| 41 | const struct touch *t = frame->active[i]; | 41 | const struct touch *t = frame->active[i]; |
| 42 | *x += t->prop[TP_POS_X]; | 42 | *x += t->x; |
| 43 | *y += t->prop[TP_POS_Y]; | 43 | *y += t->y; |
| 44 | } | 44 | } |
| 45 | *x /= n; | 45 | *x /= n; |
| 46 | *y /= n; | 46 | *y /= n; |
| @@ -55,8 +55,8 @@ static float compute_radius(float x, float y, | |||
| 55 | return r; | 55 | return r; |
| 56 | for (i = 0; i < n; i++) { | 56 | for (i = 0; i < n; i++) { |
| 57 | const struct touch *t = frame->active[i]; | 57 | const struct touch *t = frame->active[i]; |
| 58 | float dx = t->prop[TP_POS_X] - x; | 58 | float dx = t->x - x; |
| 59 | float dy = t->prop[TP_POS_Y] - y; | 59 | float dy = t->y - y; |
| 60 | r2 += dx * dx + dy * dy; | 60 | r2 += dx * dx + dy * dy; |
| 61 | } | 61 | } |
| 62 | r2 /= n; | 62 | r2 /= n; |
| @@ -75,10 +75,10 @@ static float compute_rotation(float x, float y, float r, | |||
| 75 | for (i = 0; i < n; i++) { | 75 | for (i = 0; i < n; i++) { |
| 76 | const struct touch *t = frame->active[i]; | 76 | const struct touch *t = frame->active[i]; |
| 77 | const struct touch *ot = &prev->touch[t->slot]; | 77 | const struct touch *ot = &prev->touch[t->slot]; |
| 78 | float dx = t->prop[TP_POS_X] - x; | 78 | float dx = t->x - x; |
| 79 | float dy = t->prop[TP_POS_Y] - y; | 79 | float dy = t->y - y; |
| 80 | float mx = t->prop[TP_POS_X] - ot->prop[TP_POS_X]; | 80 | float mx = t->x - ot->x; |
| 81 | float my = t->prop[TP_POS_Y] - ot->prop[TP_POS_Y]; | 81 | float my = t->y - ot->y; |
| 82 | darc2 += dx * my - dy * mx; | 82 | darc2 += dx * my - dy * mx; |
| 83 | } | 83 | } |
| 84 | darc2 /= n; | 84 | darc2 /= n; |
| @@ -225,13 +225,13 @@ void gru_compute_bbox(struct grail_coord *min, struct grail_coord *max, | |||
| 225 | int i; | 225 | int i; |
| 226 | if (frame->nactive < 1) | 226 | if (frame->nactive < 1) |
| 227 | return; | 227 | return; |
| 228 | x = frame->active[0]->prop[TP_POS_X]; | 228 | x = frame->active[0]->x; |
| 229 | y = frame->active[0]->prop[TP_POS_Y]; | 229 | y = frame->active[0]->y; |
| 230 | min->x = max->x = x; | 230 | min->x = max->x = x; |
| 231 | min->y = max->y = y; | 231 | min->y = max->y = y; |
| 232 | for (i = 1; i < frame->nactive; i++) { | 232 | for (i = 1; i < frame->nactive; i++) { |
| 233 | x = frame->active[i]->prop[TP_POS_X]; | 233 | x = frame->active[i]->x; |
| 234 | y = frame->active[i]->prop[TP_POS_Y]; | 234 | y = frame->active[i]->y; |
| 235 | if (x < min->x) | 235 | if (x < min->x) |
| 236 | min->x = x; | 236 | min->x = x; |
| 237 | if (y < min->y) | 237 | if (y < min->y) |
