summaryrefslogtreecommitdiff
path: root/src/gestures-drag.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-drag.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-drag.c')
-rw-r--r--src/gestures-drag.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/gestures-drag.c b/src/gestures-drag.c
index b894bda..253bc9d 100644
--- a/src/gestures-drag.c
+++ b/src/gestures-drag.c
@@ -82,3 +82,44 @@ int gru_drag(struct grail *ge,
82 return 1; 82 return 1;
83} 83}
84 84
85int gru_windrag(struct grail *ge,
86 const struct touch_frame *frame)
87{
88 struct gesture_recognizer *gru = ge->gru;
89 struct combo_model *state = &gru->windrag;
90 struct move_model *move = &gru->move;
91 int mask = state->active ? (move->active & fm_mask) : fm_mask;
92 if (!move->multi && !move->single) {
93 if (state->active && out_of_bounds(state, move)) {
94 gru_end(ge, state->gid, move,
95 state->prop, state->nprop);
96 state->active = 0;
97 }
98 return 0;
99 }
100 if (!(move->tickle & mask))
101 return 0;
102 if (!state->active) {
103 if (move->ntouch == 4) {
104 state->gid = gin_gid_begin(ge, GRAIL_TYPE_MDRAG,
105 PRIO_META, frame);
106 state->mintouch = 1;
107 state->maxtouch = 4;
108 state->active = 1;
109 } else if (move->ntouch == 3) {
110 state->gid = gin_gid_begin(ge, GRAIL_TYPE_EDRAG,
111 PRIO_ENV, frame);
112 state->mintouch = 1;
113 state->maxtouch = 3;
114 state->active = 1;
115 } else {
116 return 0;
117 }
118 }
119 if (!move->single && !(move->active & fm_mask))
120 return 0;
121 set_props(state, move);
122 gru_event(ge, state->gid, move, state->prop, state->nprop);
123 return 1;
124}
125