summaryrefslogtreecommitdiff
path: root/src/gestures-rotate.c
diff options
context:
space:
mode:
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}