summaryrefslogtreecommitdiff
path: root/src/gestures-drag.c
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2010-08-10 12:45:52 +0100
committerHenrik Rydberg <rydberg@euromail.se>2010-08-10 15:04:18 +0100
commitda425afd6199995ac7b6f23bf8744a435cc02e23 (patch)
tree8d92f683714eeda226aac2499b82a484fae3c137 /src/gestures-drag.c
parent7be96df1c903c11711336c5ad1859b347ae4b661 (diff)
Add property declarations to grail-types
Also add accumulated values for delta and velocity properties. Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'src/gestures-drag.c')
-rw-r--r--src/gestures-drag.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/src/gestures-drag.c b/src/gestures-drag.c
index 3f21041..a02943e 100644
--- a/src/gestures-drag.c
+++ b/src/gestures-drag.c
@@ -33,6 +33,22 @@ 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)
37{
38 if (m->single) {
39 s->prop[GRAIL_PROP_DRAG_DX] = m->fm[FM_X].raw_delta;
40 s->prop[GRAIL_PROP_DRAG_DY] = m->fm[FM_Y].raw_delta;
41 } else {
42 s->prop[GRAIL_PROP_DRAG_DX] = m->fm[FM_X].action_delta;
43 s->prop[GRAIL_PROP_DRAG_DY] = m->fm[FM_Y].action_delta;
44 }
45 s->prop[GRAIL_PROP_DRAG_VX] = m->fm[FM_X].velocity;
46 s->prop[GRAIL_PROP_DRAG_VY] = m->fm[FM_Y].velocity;
47 s->prop[GRAIL_PROP_DRAG_X] = m->fm[FM_X].value;
48 s->prop[GRAIL_PROP_DRAG_Y] = m->fm[FM_Y].value;
49 s->nprop = 6;
50}
51
36static const int fm_mask = 0x03; 52static const int fm_mask = 0x03;
37 53
38int gru_drag(struct grail *ge, 54int gru_drag(struct grail *ge,
@@ -41,11 +57,11 @@ int gru_drag(struct grail *ge,
41 struct gesture_recognizer *gru = ge->gru; 57 struct gesture_recognizer *gru = ge->gru;
42 struct combo_model *state = &gru->drag; 58 struct combo_model *state = &gru->drag;
43 struct move_model *move = &gru->move; 59 struct move_model *move = &gru->move;
44 grail_prop_t prop[DIM_GRAIL_PROP];
45 int mask = state->active ? (move->active & fm_mask) : fm_mask; 60 int mask = state->active ? (move->active & fm_mask) : fm_mask;
46 if (!move->multi && (!gru->pointer_gesture || !move->single)) { 61 if (!move->multi && (!gru->pointer_gesture || !move->single)) {
47 if (state->active) { 62 if (state->active) {
48 gru_end(ge, state->gid, move); 63 gru_end(ge, state->gid, move,
64 state->prop, state->nprop);
49 state->active = 0; 65 state->active = 0;
50 } 66 }
51 return 0; 67 return 0;
@@ -59,16 +75,10 @@ int gru_drag(struct grail *ge,
59 state->gid = gin_gid_begin(ge, type, PRIO_GESTURE, frame); 75 state->gid = gin_gid_begin(ge, type, PRIO_GESTURE, frame);
60 state->active = 1; 76 state->active = 1;
61 } 77 }
62 if (move->single) { 78 if (!move->single && !(move->active & fm_mask))
63 prop[0] = move->fm[FM_X].raw_delta; 79 return 0;
64 prop[1] = move->fm[FM_Y].raw_delta; 80 set_props(state, move);
65 } else { 81 gru_event(ge, state->gid, move, state->prop, state->nprop);
66 if (!(move->active & fm_mask))
67 return 0;
68 prop[0] = move->fm[FM_X].action_delta;
69 prop[1] = move->fm[FM_Y].action_delta;
70 }
71 gru_event(ge, state->gid, move, prop, 2);
72 return 1; 82 return 1;
73} 83}
74 84