summaryrefslogtreecommitdiff
path: root/src/gestures-pinch.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-pinch.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-pinch.c')
-rw-r--r--src/gestures-pinch.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/gestures-pinch.c b/src/gestures-pinch.c
index 0ddffa4..91e6504 100644
--- a/src/gestures-pinch.c
+++ b/src/gestures-pinch.c
@@ -100,3 +100,44 @@ int gru_pinch(struct grail *ge,
100 gru_event(ge, state->gid, move, state->prop, state->nprop); 100 gru_event(ge, state->gid, move, state->prop, state->nprop);
101 return 1; 101 return 1;
102} 102}
103
104int gru_winpinch(struct grail *ge,
105 const struct touch_frame *frame)
106{
107 struct gesture_recognizer *gru = ge->gru;
108 struct combo_model *state = &gru->winpinch;
109 struct move_model *move = &gru->move;
110 int mask = state->active ? (move->active & fm_mask) : fm_mask;
111 if (!move->multi) {
112 if (state->active && out_of_bounds(state, move)) {
113 gru_end(ge, state->gid, move,
114 state->prop, state->nprop);
115 state->active = 0;
116 }
117 return 0;
118 }
119 if (!(move->tickle & mask))
120 return 0;
121 if (!state->active) {
122 if (move->ntouch == 4) {
123 state->gid = gin_gid_begin(ge, GRAIL_TYPE_MPINCH,
124 PRIO_META, frame);
125 state->mintouch = 2;
126 state->maxtouch = 4;
127 state->active = 1;
128 } else if (move->ntouch == 3) {
129 state->gid = gin_gid_begin(ge, GRAIL_TYPE_EPINCH,
130 PRIO_ENV, frame);
131 state->mintouch = 2;
132 state->maxtouch = 3;
133 state->active = 1;
134 } else {
135 return 0;
136 }
137 }
138 if (!(move->active & fm_mask))
139 return 0;
140 set_props(state, move, frame);
141 gru_event(ge, state->gid, move, state->prop, state->nprop);
142 return 1;
143}