diff options
Diffstat (limited to 'src/gestures-pan.c')
| -rw-r--r-- | src/gestures-pan.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/gestures-pan.c b/src/gestures-pan.c index 320a987..a023122 100644 --- a/src/gestures-pan.c +++ b/src/gestures-pan.c | |||
| @@ -33,6 +33,8 @@ static const int getype[DIM_TOUCH + 1] = { | |||
| 33 | GRAIL_TYPE_HAND, | 33 | GRAIL_TYPE_HAND, |
| 34 | }; | 34 | }; |
| 35 | 35 | ||
| 36 | static const int fm_mask = 0x03; | ||
| 37 | |||
| 36 | int gru_pan(struct grail *ge, | 38 | int gru_pan(struct grail *ge, |
| 37 | const struct touch_frame *frame) | 39 | const struct touch_frame *frame) |
| 38 | { | 40 | { |
| @@ -40,6 +42,7 @@ int gru_pan(struct grail *ge, | |||
| 40 | struct combo_model *state = &gru->pan; | 42 | struct combo_model *state = &gru->pan; |
| 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_pan(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 | 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,10 +59,10 @@ int gru_pan(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->x.active && !move->y.active) | 62 | if (!(move->active & fm_mask)) |
| 60 | return 0; | 63 | return 0; |
| 61 | prop[0] = move->x.active ? move->x.delta : 0; | 64 | prop[0] = move->fm[FM_X].delta; |
| 62 | prop[1] = move->y.active ? move->y.delta : 0; | 65 | prop[1] = move->fm[FM_Y].delta; |
| 63 | gru_event(ge, state->gid, move, prop, 2); | 66 | gru_event(ge, state->gid, move, prop, 2); |
| 64 | return 1; | 67 | return 1; |
| 65 | } | 68 | } |
