summaryrefslogtreecommitdiff
path: root/src/gestures-combo.c
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2010-08-07 18:28:29 +0200
committerHenrik Rydberg <rydberg@euromail.se>2010-08-07 18:28:29 +0200
commitee4a0c6821a1b79c3d18c6ef6d7ed6d37df74755 (patch)
tree6516f6f92f572a60eca0fe6a43bc93a7f9570a2c /src/gestures-combo.c
parent5b1126b08faa91bbe26d89c63e5c514911088a0a (diff)
gesture: Improved tickle/active logic
Reorganize the mode model to use bitmasks for tickle and active, and refine the tickle logic for each gesture.
Diffstat (limited to 'src/gestures-combo.c')
-rw-r--r--src/gestures-combo.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/gestures-combo.c b/src/gestures-combo.c
index 0f4dd7e..6ce6197 100644
--- a/src/gestures-combo.c
+++ b/src/gestures-combo.c
@@ -33,6 +33,8 @@ static const int getype[DIM_TOUCH + 1] = {
33 GRAIL_TYPE_COMBO5, 33 GRAIL_TYPE_COMBO5,
34}; 34};
35 35
36static const int fm_mask = 0x0f;
37
36int gru_combo(struct grail *ge, 38int gru_combo(struct grail *ge,
37 const struct touch_frame *frame) 39 const struct touch_frame *frame)
38{ 40{
@@ -40,6 +42,7 @@ int gru_combo(struct grail *ge,
40 struct combo_model *state = &gru->combo; 42 struct combo_model *state = &gru->combo;
41 struct move_model *move = &gru->move; 43 struct move_model *move = &gru->move;
42 grail_prop_t prop[DIM_GRAIL_PROP]; 44 grail_prop_t prop[DIM_GRAIL_PROP];
45 int mask = state->active ? (move->active & fm_mask) : fm_mask;
43 if (!move->multi) { 46 if (!move->multi) {
44 if (state->active) { 47 if (state->active) {
45 gru_end(ge, state->gid, move); 48 gru_end(ge, state->gid, move);
@@ -47,8 +50,7 @@ int gru_combo(struct grail *ge,
47 } 50 }
48 return 0; 51 return 0;
49 } 52 }
50 if (!move->x.tickle && !move->y.tickle && 53 if (!(move->tickle & mask))
51 !move->r.tickle && !move->a.tickle)
52 return 0; 54 return 0;
53 if (!state->active) { 55 if (!state->active) {
54 int type = getype[move->ntouch]; 56 int type = getype[move->ntouch];
@@ -57,13 +59,12 @@ int gru_combo(struct grail *ge,
57 state->gid = gin_gid_begin(ge, type, PRIO_GESTURE, frame); 59 state->gid = gin_gid_begin(ge, type, PRIO_GESTURE, frame);
58 state->active = 1; 60 state->active = 1;
59 } 61 }
60 if (!move->x.active && !move->y.active && 62 if (!(move->active & fm_mask))
61 !move->r.active && !move->a.active)
62 return 0; 63 return 0;
63 prop[0] = move->x.active ? move->x.delta : 0; 64 prop[0] = move->fm[FM_X].delta;
64 prop[1] = move->y.active ? move->y.delta : 0; 65 prop[1] = move->fm[FM_Y].delta;
65 prop[2] = move->r.active ? move->r.delta : 0; 66 prop[2] = move->fm[FM_R].delta;
66 prop[3] = move->a.active ? move->a.delta : 0; 67 prop[3] = move->fm[FM_A].delta;
67 gru_event(ge, state->gid, move, prop, 4); 68 gru_event(ge, state->gid, move, prop, 4);
68 return 1; 69 return 1;
69} 70}