diff options
| -rw-r--r-- | include/grail-types.h | 4 | ||||
| -rw-r--r-- | src/gestures-rotate.c | 16 |
2 files changed, 17 insertions, 3 deletions
diff --git a/include/grail-types.h b/include/grail-types.h index 27450fe..474261d 100644 --- a/include/grail-types.h +++ b/include/grail-types.h | |||
| @@ -78,6 +78,10 @@ | |||
| 78 | #define GRAIL_PROP_ROTATE_DA 0 /* angle delta */ | 78 | #define GRAIL_PROP_ROTATE_DA 0 /* angle delta */ |
| 79 | #define GRAIL_PROP_ROTATE_VA 1 /* angular velocity */ | 79 | #define GRAIL_PROP_ROTATE_VA 1 /* angular velocity */ |
| 80 | #define GRAIL_PROP_ROTATE_A 2 /* angle */ | 80 | #define GRAIL_PROP_ROTATE_A 2 /* angle */ |
| 81 | #define GRAIL_PROP_ROTATE_X1 3 /* bounding box x1 */ | ||
| 82 | #define GRAIL_PROP_ROTATE_Y1 4 /* bounding box y1 */ | ||
| 83 | #define GRAIL_PROP_ROTATE_X2 5 /* bounding box x2 */ | ||
| 84 | #define GRAIL_PROP_ROTATE_Y2 6 /* bounding box y2 */ | ||
| 81 | 85 | ||
| 82 | #define GRAIL_MAIN_TAP 3 | 86 | #define GRAIL_MAIN_TAP 3 |
| 83 | #define GRAIL_PROP_TAP_DT 0 /* tap time (ms) */ | 87 | #define GRAIL_PROP_TAP_DT 0 /* tap time (ms) */ |
diff --git a/src/gestures-rotate.c b/src/gestures-rotate.c index 5763294..23bbfd6 100644 --- a/src/gestures-rotate.c +++ b/src/gestures-rotate.c | |||
| @@ -35,12 +35,22 @@ static const int getype[DIM_TOUCH + 1] = { | |||
| 35 | 35 | ||
| 36 | static const int fm_mask = 0x08; | 36 | static const int fm_mask = 0x08; |
| 37 | 37 | ||
| 38 | static void set_props(struct combo_model *s, const struct move_model *m) | 38 | static void set_props(struct combo_model *s, const struct move_model *m, |
| 39 | const struct touch_frame *frame) | ||
| 39 | { | 40 | { |
| 41 | struct grail_coord min, max; | ||
| 40 | s->prop[GRAIL_PROP_ROTATE_DA] = m->fm[FM_A].action_delta; | 42 | s->prop[GRAIL_PROP_ROTATE_DA] = m->fm[FM_A].action_delta; |
| 41 | s->prop[GRAIL_PROP_ROTATE_VA] = m->fm[FM_A].velocity; | 43 | s->prop[GRAIL_PROP_ROTATE_VA] = m->fm[FM_A].velocity; |
| 42 | s->prop[GRAIL_PROP_ROTATE_A] = m->fm[FM_A].value; | 44 | s->prop[GRAIL_PROP_ROTATE_A] = m->fm[FM_A].value; |
| 43 | s->nprop = 3; | 45 | s->nprop = 3; |
| 46 | if (!frame->nactive) | ||
| 47 | return; | ||
| 48 | gru_compute_bbox(&min, &max, frame); | ||
| 49 | s->prop[GRAIL_PROP_ROTATE_X1] = min.x; | ||
| 50 | s->prop[GRAIL_PROP_ROTATE_Y1] = min.y; | ||
| 51 | s->prop[GRAIL_PROP_ROTATE_X2] = max.x; | ||
| 52 | s->prop[GRAIL_PROP_ROTATE_Y2] = max.y; | ||
| 53 | s->nprop = 7; | ||
| 44 | } | 54 | } |
| 45 | 55 | ||
| 46 | int gru_rotate(struct grail *ge, | 56 | int gru_rotate(struct grail *ge, |
| @@ -69,7 +79,7 @@ int gru_rotate(struct grail *ge, | |||
| 69 | } | 79 | } |
| 70 | if (!(move->active & fm_mask)) | 80 | if (!(move->active & fm_mask)) |
| 71 | return 0; | 81 | return 0; |
| 72 | set_props(state, move); | 82 | set_props(state, move, frame); |
| 73 | gru_event(ge, state->gid, move, state->prop, state->nprop); | 83 | gru_event(ge, state->gid, move, state->prop, state->nprop); |
| 74 | return 1; | 84 | return 1; |
| 75 | } | 85 | } |
| @@ -110,7 +120,7 @@ int gru_winrotate(struct grail *ge, | |||
| 110 | } | 120 | } |
| 111 | if (!(move->active & fm_mask)) | 121 | if (!(move->active & fm_mask)) |
| 112 | return 0; | 122 | return 0; |
| 113 | set_props(state, move); | 123 | set_props(state, move, frame); |
| 114 | gru_event(ge, state->gid, move, state->prop, state->nprop); | 124 | gru_event(ge, state->gid, move, state->prop, state->nprop); |
| 115 | return 1; | 125 | return 1; |
| 116 | } | 126 | } |
