summaryrefslogtreecommitdiff
path: root/src/gestures-rotate.c
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2010-08-19 22:15:55 +0200
committerHenrik Rydberg <rydberg@euromail.se>2010-08-19 22:15:55 +0200
commit76f51a7675801acfe8e58c6a21192668d23d3320 (patch)
tree73109e613e93fbb8f20fabdbec9f7e0d5356f4dd /src/gestures-rotate.c
parent8331322a0fec7277366a29a970eafbb795c08432 (diff)
Add contact information to the property list
Add the five first contacts to the property list, and unify the handling of all gesture types in this regard. To avoid duplication, move the scaling of properties closer to the gesture recognizer. Move all gesture event handling code to grail-event.c, simplifying the structure somewhat. Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'src/gestures-rotate.c')
-rw-r--r--src/gestures-rotate.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/gestures-rotate.c b/src/gestures-rotate.c
index 23bbfd6..8985257 100644
--- a/src/gestures-rotate.c
+++ b/src/gestures-rotate.c
@@ -35,22 +35,15 @@ static const int getype[DIM_TOUCH + 1] = {
35 35
36static const int fm_mask = 0x08; 36static const int fm_mask = 0x08;
37 37
38static void set_props(struct combo_model *s, const struct move_model *m, 38static void set_props(const struct gesture_inserter *gin,
39 struct combo_model *s, const struct move_model *m,
39 const struct touch_frame *frame) 40 const struct touch_frame *frame)
40{ 41{
41 struct grail_coord min, max;
42 s->prop[GRAIL_PROP_ROTATE_DA] = m->fm[FM_A].action_delta; 42 s->prop[GRAIL_PROP_ROTATE_DA] = m->fm[FM_A].action_delta;
43 s->prop[GRAIL_PROP_ROTATE_VA] = m->fm[FM_A].velocity; 43 s->prop[GRAIL_PROP_ROTATE_VA] = m->fm[FM_A].velocity;
44 s->prop[GRAIL_PROP_ROTATE_A] = m->fm[FM_A].value; 44 s->prop[GRAIL_PROP_ROTATE_A] = m->fm[FM_A].value;
45 s->nprop = 3; 45 s->nprop = 3;
46 if (!frame->nactive) 46 s->nprop += gin_add_contact_props(gin, s->prop + s->nprop, frame);
47 return;
48 gru_compute_bbox(&min, &max, frame);
49 s->prop[GRAIL_PROP_ROTATE_X1] = min.x;
50 s->prop[GRAIL_PROP_ROTATE_Y1] = min.y;
51 s->prop[GRAIL_PROP_ROTATE_X2] = max.x;
52 s->prop[GRAIL_PROP_ROTATE_Y2] = max.y;
53 s->nprop = 7;
54} 47}
55 48
56int gru_rotate(struct grail *ge, 49int gru_rotate(struct grail *ge,
@@ -79,7 +72,7 @@ int gru_rotate(struct grail *ge,
79 } 72 }
80 if (!(move->active & fm_mask)) 73 if (!(move->active & fm_mask))
81 return 0; 74 return 0;
82 set_props(state, move, frame); 75 set_props(ge->gin, state, move, frame);
83 gru_event(ge, state->gid, move, state->prop, state->nprop); 76 gru_event(ge, state->gid, move, state->prop, state->nprop);
84 return 1; 77 return 1;
85} 78}
@@ -120,7 +113,7 @@ int gru_winrotate(struct grail *ge,
120 } 113 }
121 if (!(move->active & fm_mask)) 114 if (!(move->active & fm_mask))
122 return 0; 115 return 0;
123 set_props(state, move, frame); 116 set_props(ge->gin, state, move, frame);
124 gru_event(ge, state->gid, move, state->prop, state->nprop); 117 gru_event(ge, state->gid, move, state->prop, state->nprop);
125 return 1; 118 return 1;
126} 119}