summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2010-08-11 17:31:55 +0100
committerHenrik Rydberg <rydberg@euromail.se>2010-08-11 17:59:29 +0100
commita73179326ed8fda9588b8650209bd230957c2876 (patch)
tree7fcdb897077e71676a487f718bba7ea3811d9e93
parent9b020a9c6ff875c5f6511b50480f07beabb9a694 (diff)
api: add bounding box to rotate gestures
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
-rw-r--r--include/grail-types.h4
-rw-r--r--src/gestures-rotate.c16
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
36static const int fm_mask = 0x08; 36static const int fm_mask = 0x08;
37 37
38static void set_props(struct combo_model *s, const struct move_model *m) 38static 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
46int gru_rotate(struct grail *ge, 56int 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}