~fginther/grail/grail-2.0.1.1-oneiric

« back to all changes in this revision

Viewing changes to src/grail-gestures.c

  • Committer: Francis Ginther
  • Date: 2012-08-22 18:35:11 UTC
  • mfrom: (20.2.19 upstream)
  • Revision ID: francis.ginther@canonical.com-20120822183511-yxwny2hixhyu2z42
* New upstream microrelease, bug fixes only
  - Rename project to simply 'grail' (LP: #1040218)
* Updated debian/watch file for project rename

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
static const float EPS = 1e-3;
36
36
 
37
37
static void compute_position(float *x, float *y,
38
 
                             const struct utouch_frame *frame)
 
38
                             const struct oif_frame *frame)
39
39
{
40
40
        int i, n = frame->num_active;
41
41
        *x = 0;
43
43
        if (n < 1)
44
44
                return;
45
45
        for (i = 0; i < n; i++) {
46
 
                const struct utouch_contact *t = frame->active[i];
 
46
                const struct oif_contact *t = frame->active[i];
47
47
                *x += t->x;
48
48
                *y += t->y;
49
49
        }
52
52
}
53
53
 
54
54
static float compute_radius(float x, float y,
55
 
                            const struct utouch_frame *frame)
 
55
                            const struct oif_frame *frame)
56
56
{
57
57
        int i, n = frame->num_active;
58
58
        float r = 0, r2 = 0;
59
59
        if (n < 2)
60
60
                return r;
61
61
        for (i = 0; i < n; i++) {
62
 
                const struct utouch_contact *t = frame->active[i];
 
62
                const struct oif_contact *t = frame->active[i];
63
63
                float dx = t->x - x;
64
64
                float dy = t->y - y;
65
65
                r2 += dx * dx + dy * dy;
70
70
}
71
71
 
72
72
static float compute_rotation(float x, float y, float r,
73
 
                              const struct utouch_frame *frame)
 
73
                              const struct oif_frame *frame)
74
74
{
75
75
        int i, n = frame->num_active;
76
76
        float da = 0, darc2 = 0;
77
77
        if (n < 2)
78
78
                return da;
79
79
        for (i = 0; i < n; i++) {
80
 
                const struct utouch_contact *t = frame->active[i];
81
 
                const struct utouch_contact *ot = t->prev;
 
80
                const struct oif_contact *t = frame->active[i];
 
81
                const struct oif_contact *ot = t->prev;
82
82
                float dx = t->x - x;
83
83
                float dy = t->y - y;
84
84
                float mx = t->x - ot->x;
137
137
 
138
138
void gru_init_motion(struct grail *ge)
139
139
{
140
 
        struct utouch_surface *s = utouch_frame_get_surface(ge->impl->fh);
 
140
        struct oif_surface *s = oif_frame_get_surface(ge->impl->fh);
141
141
        struct gesture_recognizer *gru = ge->gru;
142
142
        struct move_model *m = &gru->move;
143
143
        float U[DIM_FM]; /* Device unit dimensions */
160
160
}
161
161
 
162
162
void gru_motion(struct grail *ge,
163
 
                const struct utouch_frame *frame)
 
163
                const struct oif_frame *frame)
164
164
{
165
 
        const struct utouch_surface *s = utouch_frame_get_surface(ge->impl->fh);
 
165
        const struct oif_surface *s = oif_frame_get_surface(ge->impl->fh);
166
166
        struct gesture_recognizer *gru = ge->gru;
167
167
        struct move_model *m = &gru->move;
168
168
        grail_time_t t = frame->time;