summaryrefslogtreecommitdiff
path: root/src/gestures-drag.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-drag.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-drag.c')
-rw-r--r--src/gestures-drag.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/gestures-drag.c b/src/gestures-drag.c
index 253bc9d..8b57b99 100644
--- a/src/gestures-drag.c
+++ b/src/gestures-drag.c
@@ -33,20 +33,27 @@ static const int getype[DIM_TOUCH + 1] = {
33 GRAIL_TYPE_DRAG5, 33 GRAIL_TYPE_DRAG5,
34}; 34};
35 35
36static void set_props(struct combo_model *s, const struct move_model *m) 36static void set_props(const struct gesture_inserter *gin,
37 struct combo_model *s, const struct move_model *m,
38 const struct touch_frame *frame)
37{ 39{
38 if (m->single) { 40 if (m->single) {
39 s->prop[GRAIL_PROP_DRAG_DX] = m->fm[FM_X].raw_delta; 41 s->prop[GRAIL_PROP_DRAG_DX] =
40 s->prop[GRAIL_PROP_DRAG_DY] = m->fm[FM_Y].raw_delta; 42 gin->scale_x * m->fm[FM_X].raw_delta;
43 s->prop[GRAIL_PROP_DRAG_DY] =
44 gin->scale_y * m->fm[FM_Y].raw_delta;
41 } else { 45 } else {
42 s->prop[GRAIL_PROP_DRAG_DX] = m->fm[FM_X].action_delta; 46 s->prop[GRAIL_PROP_DRAG_DX] =
43 s->prop[GRAIL_PROP_DRAG_DY] = m->fm[FM_Y].action_delta; 47 gin->scale_x * m->fm[FM_X].action_delta;
48 s->prop[GRAIL_PROP_DRAG_DY] =
49 gin->scale_y * m->fm[FM_Y].action_delta;
44 } 50 }
45 s->prop[GRAIL_PROP_DRAG_VX] = m->fm[FM_X].velocity; 51 s->prop[GRAIL_PROP_DRAG_VX] = gin->scale_x * m->fm[FM_X].velocity;
46 s->prop[GRAIL_PROP_DRAG_VY] = m->fm[FM_Y].velocity; 52 s->prop[GRAIL_PROP_DRAG_VY] = gin->scale_y * m->fm[FM_Y].velocity;
47 s->prop[GRAIL_PROP_DRAG_X] = m->fm[FM_X].value; 53 s->prop[GRAIL_PROP_DRAG_X] = gin_prop_x(gin, m->fm[FM_X].value);
48 s->prop[GRAIL_PROP_DRAG_Y] = m->fm[FM_Y].value; 54 s->prop[GRAIL_PROP_DRAG_Y] = gin_prop_y(gin, m->fm[FM_Y].value);
49 s->nprop = 6; 55 s->nprop = 6;
56 s->nprop += gin_add_contact_props(gin, s->prop + s->nprop, frame);
50} 57}
51 58
52static const int fm_mask = 0x03; 59static const int fm_mask = 0x03;
@@ -77,7 +84,7 @@ int gru_drag(struct grail *ge,
77 } 84 }
78 if (!move->single && !(move->active & fm_mask)) 85 if (!move->single && !(move->active & fm_mask))
79 return 0; 86 return 0;
80 set_props(state, move); 87 set_props(ge->gin, state, move, frame);
81 gru_event(ge, state->gid, move, state->prop, state->nprop); 88 gru_event(ge, state->gid, move, state->prop, state->nprop);
82 return 1; 89 return 1;
83} 90}
@@ -118,7 +125,7 @@ int gru_windrag(struct grail *ge,
118 } 125 }
119 if (!move->single && !(move->active & fm_mask)) 126 if (!move->single && !(move->active & fm_mask))
120 return 0; 127 return 0;
121 set_props(state, move); 128 set_props(ge->gin, state, move, frame);
122 gru_event(ge, state->gid, move, state->prop, state->nprop); 129 gru_event(ge, state->gid, move, state->prop, state->nprop);
123 return 1; 130 return 1;
124} 131}