From 477f338c8de5e20d82e7c861bba742bc4c203a42 Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Wed, 11 Aug 2010 15:30:42 +0100 Subject: 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 --- src/gestures-drag.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'src/gestures-drag.c') 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, return 1; } +int gru_windrag(struct grail *ge, + const struct touch_frame *frame) +{ + struct gesture_recognizer *gru = ge->gru; + struct combo_model *state = &gru->windrag; + struct move_model *move = &gru->move; + int mask = state->active ? (move->active & fm_mask) : fm_mask; + if (!move->multi && !move->single) { + if (state->active && out_of_bounds(state, move)) { + gru_end(ge, state->gid, move, + state->prop, state->nprop); + state->active = 0; + } + return 0; + } + if (!(move->tickle & mask)) + return 0; + if (!state->active) { + if (move->ntouch == 4) { + state->gid = gin_gid_begin(ge, GRAIL_TYPE_MDRAG, + PRIO_META, frame); + state->mintouch = 1; + state->maxtouch = 4; + state->active = 1; + } else if (move->ntouch == 3) { + state->gid = gin_gid_begin(ge, GRAIL_TYPE_EDRAG, + PRIO_ENV, frame); + state->mintouch = 1; + state->maxtouch = 3; + state->active = 1; + } else { + return 0; + } + } + if (!move->single && !(move->active & fm_mask)) + return 0; + set_props(state, move); + gru_event(ge, state->gid, move, state->prop, state->nprop); + return 1; +} + -- cgit v1.2.3