summaryrefslogtreecommitdiff
path: root/src/gestures-rotate.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-rotate.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-rotate.c')
-rw-r--r--src/gestures-rotate.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/gestures-rotate.c b/src/gestures-rotate.c
index 105340b..5db4228 100644
--- a/src/gestures-rotate.c
+++ b/src/gestures-rotate.c
@@ -33,6 +33,8 @@ static const int getype[DIM_TOUCH + 1] = {
33 GRAIL_TYPE_REVOLVE, 33 GRAIL_TYPE_REVOLVE,
34}; 34};
35 35
36static const int fm_mask = 0x08;
37
36int gru_rotate(struct grail *ge, 38int gru_rotate(struct grail *ge,
37 const struct touch_frame *frame) 39 const struct touch_frame *frame)
38{ 40{
@@ -40,6 +42,7 @@ int gru_rotate(struct grail *ge,
40 struct combo_model *state = &gru->rotate; 42 struct combo_model *state = &gru->rotate;
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,7 +50,7 @@ int gru_rotate(struct grail *ge,
47 } 50 }
48 return 0; 51 return 0;
49 } 52 }
50 if (!move->a.tickle) 53 if (!(move->tickle & mask))
51 return 0; 54 return 0;
52 if (!state->active) { 55 if (!state->active) {
53 int type = getype[move->ntouch]; 56 int type = getype[move->ntouch];
@@ -56,9 +59,9 @@ int gru_rotate(struct grail *ge,
56 state->gid = gin_gid_begin(ge, type, PRIO_GESTURE, frame); 59 state->gid = gin_gid_begin(ge, type, PRIO_GESTURE, frame);
57 state->active = 1; 60 state->active = 1;
58 } 61 }
59 if (!move->a.active) 62 if (!(move->active & fm_mask))
60 return 0; 63 return 0;
61 prop[0] = move->a.delta; 64 prop[0] = move->fm[FM_A].delta;
62 gru_event(ge, state->gid, move, prop, 1); 65 gru_event(ge, state->gid, move, prop, 1);
63 return 1; 66 return 1;
64} 67}