summaryrefslogtreecommitdiff
path: root/src/gestures-rotate.c
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2010-08-11 15:30:42 +0100
committerHenrik Rydberg <rydberg@euromail.se>2010-08-11 17:59:29 +0100
commit477f338c8de5e20d82e7c861bba742bc4c203a42 (patch)
treebb5c35fb7acc742f06e5f03bb4702e3e3cfa6e45 /src/gestures-rotate.c
parent7ce1ea3d30d2827310b04ef316c242b7dbf7f9dd (diff)
Add environment and meta gestures
With meta gestures, the gesture starts given a certain number of fingers, but can then continue even if the number of fingers change. By configuration, such gestures live on a different priority plane from normal gestures. To match window manager specs, this patch adds the environment and meta planes, and add drag, pinch and rotate gestures initiated with three and four fingers, respectively. Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'src/gestures-rotate.c')
-rw-r--r--src/gestures-rotate.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/gestures-rotate.c b/src/gestures-rotate.c
index 52b5004..5763294 100644
--- a/src/gestures-rotate.c
+++ b/src/gestures-rotate.c
@@ -73,3 +73,44 @@ int gru_rotate(struct grail *ge,
73 gru_event(ge, state->gid, move, state->prop, state->nprop); 73 gru_event(ge, state->gid, move, state->prop, state->nprop);
74 return 1; 74 return 1;
75} 75}
76
77int gru_winrotate(struct grail *ge,
78 const struct touch_frame *frame)
79{
80 struct gesture_recognizer *gru = ge->gru;
81 struct combo_model *state = &gru->winrotate;
82 struct move_model *move = &gru->move;
83 int mask = state->active ? (move->active & fm_mask) : fm_mask;
84 if (!move->multi) {
85 if (state->active && out_of_bounds(state, move)) {
86 gru_end(ge, state->gid, move,
87 state->prop, state->nprop);
88 state->active = 0;
89 }
90 return 0;
91 }
92 if (!(move->tickle & mask))
93 return 0;
94 if (!state->active) {
95 if (move->ntouch == 4) {
96 state->gid = gin_gid_begin(ge, GRAIL_TYPE_MROTATE,
97 PRIO_META, frame);
98 state->mintouch = 2;
99 state->maxtouch = 4;
100 state->active = 1;
101 } else if (move->ntouch == 3) {
102 state->gid = gin_gid_begin(ge, GRAIL_TYPE_EROTATE,
103 PRIO_ENV, frame);
104 state->mintouch = 2;
105 state->maxtouch = 3;
106 state->active = 1;
107 } else {
108 return 0;
109 }
110 }
111 if (!(move->active & fm_mask))
112 return 0;
113 set_props(state, move);
114 gru_event(ge, state->gid, move, state->prop, state->nprop);
115 return 1;
116}