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