summaryrefslogtreecommitdiff
path: root/src/gestures-pinch.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gestures-pinch.c')
-rw-r--r--src/gestures-pinch.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/gestures-pinch.c b/src/gestures-pinch.c
index 18007de..0ddffa4 100644
--- a/src/gestures-pinch.c
+++ b/src/gestures-pinch.c
@@ -35,12 +35,39 @@ static const int getype[DIM_TOUCH + 1] = {
35 35
36static const int fm_mask = 0x04; 36static const int fm_mask = 0x04;
37 37
38static void set_props(struct combo_model *s, const struct move_model *m) 38static void set_props(struct combo_model *s,
39 const struct move_model *m,
40 const struct touch_frame *frame)
39{ 41{
42 float x1, y1, x2, y2, x, y;
43 int i;
40 s->prop[GRAIL_PROP_PINCH_DR] = m->fm[FM_R].action_delta; 44 s->prop[GRAIL_PROP_PINCH_DR] = m->fm[FM_R].action_delta;
41 s->prop[GRAIL_PROP_PINCH_VR] = m->fm[FM_R].velocity; 45 s->prop[GRAIL_PROP_PINCH_VR] = m->fm[FM_R].velocity;
42 s->prop[GRAIL_PROP_PINCH_R] = m->fm[FM_R].value; 46 s->prop[GRAIL_PROP_PINCH_R] = m->fm[FM_R].value;
43 s->nprop = 3; 47 s->nprop = 3;
48 if (!frame->nactive)
49 return;
50 x = frame->active[0]->prop[TP_POS_X];
51 y = frame->active[0]->prop[TP_POS_Y];
52 x1 = x2 = x;
53 y1 = y2 = y;
54 for (i = 1; i < frame->nactive; i++) {
55 x = frame->active[i]->prop[TP_POS_X];
56 y = frame->active[i]->prop[TP_POS_Y];
57 if (x < x1)
58 x1 = x;
59 if (y < y1)
60 y1 = y;
61 if (x > x2)
62 x2 = x;
63 if (y > y2)
64 y2 = y;
65 }
66 s->prop[GRAIL_PROP_PINCH_X1] = x1;
67 s->prop[GRAIL_PROP_PINCH_Y1] = y1;
68 s->prop[GRAIL_PROP_PINCH_X2] = x2;
69 s->prop[GRAIL_PROP_PINCH_Y2] = y2;
70 s->nprop = 7;
44} 71}
45 72
46int gru_pinch(struct grail *ge, 73int gru_pinch(struct grail *ge,
@@ -69,7 +96,7 @@ int gru_pinch(struct grail *ge,
69 } 96 }
70 if (!(move->active & fm_mask)) 97 if (!(move->active & fm_mask))
71 return 0; 98 return 0;
72 set_props(state, move); 99 set_props(state, move, frame);
73 gru_event(ge, state->gid, move, state->prop, state->nprop); 100 gru_event(ge, state->gid, move, state->prop, state->nprop);
74 return 1; 101 return 1;
75} 102}