Merge lp:~oif-packaging/grail/packaging.touch-gestures into lp:grail/ubuntu
- packaging.touch-gestures
- Merge into packaging
Proposed by
Chase Douglas
Status: | Merged |
---|---|
Merged at revision: | 79 |
Proposed branch: | lp:~oif-packaging/grail/packaging.touch-gestures |
Merge into: | lp:grail/ubuntu |
Diff against target: |
645 lines (+612/-0) 6 files modified
debian/changelog (+14/-0) debian/patches/0001-set-proper-tap-properties.patch (+13/-0) debian/patches/0002-disable-semi-mt-rotation.patch (+25/-0) debian/patches/0003-add-touch-gestures.patch (+508/-0) debian/patches/0004-dont-hold-back-active-gestures.patch (+48/-0) debian/patches/series (+4/-0) |
To merge this branch: | bzr merge lp:~oif-packaging/grail/packaging.touch-gestures |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Duncan McGreggor (community) | Approve | ||
Henrik Rydberg (community) | Approve | ||
Review via email: mp+55235@code.launchpad.net |
Commit message
Description of the change
Includes three patches for the associated bugs:
* Prevent semi-mt rotation
* Add touch gestures
* Ensure gesture end events are sent
To post a comment you must log in.
- 84. By Chase Douglas
-
Fold in related fix to 0004-dont-
hold-back- active- gestures. patch
Revision history for this message
Duncan McGreggor (oubiwann) wrote : | # |
I'm okay with bad style, if it's a bug fix. I can't think of a reason not to include this bug fix, so I'm +1'ing it.
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'debian/changelog' | |||
2 | --- debian/changelog 2011-03-09 17:14:52 +0000 | |||
3 | +++ debian/changelog 2011-03-30 15:42:36 +0000 | |||
4 | @@ -1,3 +1,17 @@ | |||
5 | 1 | utouch-grail (1.0.20-0ubuntu3) UNRELEASED; urgency=low | ||
6 | 2 | |||
7 | 3 | * Prevent rotation gestures on semi-mt trackpads (LP: #724979) | ||
8 | 4 | * Add touch gestures (LP: #742582) | ||
9 | 5 | * Ensure all started gestures end (LP: #744391) | ||
10 | 6 | |||
11 | 7 | -- Chase Douglas <chase.douglas@ubuntu.com> Mon, 28 Mar 2011 16:19:49 -0400 | ||
12 | 8 | |||
13 | 9 | utouch-grail (1.0.20-0ubuntu2) natty; urgency=low | ||
14 | 10 | |||
15 | 11 | * Show all properties on multitouch taps (LP: #742006) | ||
16 | 12 | |||
17 | 13 | -- Chase Douglas <chase.douglas@ubuntu.com> Thu, 24 Mar 2011 17:50:30 -0400 | ||
18 | 14 | |||
19 | 1 | utouch-grail (1.0.20-0ubuntu1) natty; urgency=low | 15 | utouch-grail (1.0.20-0ubuntu1) natty; urgency=low |
20 | 2 | 16 | ||
21 | 3 | [ Henrik Rydberg ] | 17 | [ Henrik Rydberg ] |
22 | 4 | 18 | ||
23 | === added directory 'debian/patches' | |||
24 | === added file 'debian/patches/0001-set-proper-tap-properties.patch' | |||
25 | --- debian/patches/0001-set-proper-tap-properties.patch 1970-01-01 00:00:00 +0000 | |||
26 | +++ debian/patches/0001-set-proper-tap-properties.patch 2011-03-30 15:42:36 +0000 | |||
27 | @@ -0,0 +1,13 @@ | |||
28 | 1 | === modified file 'src/gestures-tapping.c' | ||
29 | 2 | --- a/src/gestures-tapping.c 2011-03-17 09:48:13 +0000 | ||
30 | 3 | +++ b/src/gestures-tapping.c 2011-03-24 19:52:47 +0000 | ||
31 | 4 | @@ -89,7 +89,7 @@ | ||
32 | 5 | } | ||
33 | 6 | if (!move->ntouch) | ||
34 | 7 | return 0; | ||
35 | 8 | - set_props(ge->gin, state, move, frame); | ||
36 | 9 | + state->prop[GRAIL_PROP_TAP_DT] = move->time - state->start; | ||
37 | 10 | if ((move->active & fm_mask) || | ||
38 | 11 | move->time - state->start > move->fm[FM_X].bar_ms) { | ||
39 | 12 | gin_gid_discard(ge, state->gid); | ||
40 | 13 | |||
41 | 0 | 14 | ||
42 | === added file 'debian/patches/0002-disable-semi-mt-rotation.patch' | |||
43 | --- debian/patches/0002-disable-semi-mt-rotation.patch 1970-01-01 00:00:00 +0000 | |||
44 | +++ debian/patches/0002-disable-semi-mt-rotation.patch 2011-03-30 15:42:36 +0000 | |||
45 | @@ -0,0 +1,25 @@ | |||
46 | 1 | === modified file 'src/grail-gestures.c' | ||
47 | 2 | --- a/src/grail-gestures.c 2011-02-24 22:50:31 +0000 | ||
48 | 3 | +++ b/src/grail-gestures.c 2011-03-17 09:43:52 +0000 | ||
49 | 4 | @@ -167,6 +167,7 @@ | ||
50 | 5 | void gru_motion(struct grail *ge, | ||
51 | 6 | const struct utouch_frame *frame) | ||
52 | 7 | { | ||
53 | 8 | + const struct utouch_surface *s = utouch_frame_get_surface(ge->impl->fh); | ||
54 | 9 | struct gesture_recognizer *gru = ge->gru; | ||
55 | 10 | struct move_model *m = &gru->move; | ||
56 | 11 | grail_time_t t = frame->time; | ||
57 | 12 | @@ -197,8 +198,10 @@ | ||
58 | 13 | r = compute_radius(x, y, frame); | ||
59 | 14 | r = move_filter(&m->fm[FM_R], r); | ||
60 | 15 | a = m->fm[FM_A].value; | ||
61 | 16 | - a += compute_rotation(x, y, r, frame); | ||
62 | 17 | - a = move_filter(&m->fm[FM_A], a); | ||
63 | 18 | + if (!s->is_semi_mt) { | ||
64 | 19 | + a += compute_rotation(x, y, r, frame); | ||
65 | 20 | + a = move_filter(&m->fm[FM_A], a); | ||
66 | 21 | + } | ||
67 | 22 | move_update(m, FM_X, x, t); | ||
68 | 23 | move_update(m, FM_Y, y, t); | ||
69 | 24 | move_update(m, FM_R, r, t); | ||
70 | 25 | |||
71 | 0 | 26 | ||
72 | === added file 'debian/patches/0003-add-touch-gestures.patch' | |||
73 | --- debian/patches/0003-add-touch-gestures.patch 1970-01-01 00:00:00 +0000 | |||
74 | +++ debian/patches/0003-add-touch-gestures.patch 2011-03-30 15:42:36 +0000 | |||
75 | @@ -0,0 +1,508 @@ | |||
76 | 1 | === modified file 'include/grail-types.h' | ||
77 | 2 | --- a/include/grail-types.h 2010-08-19 20:36:11 +0000 | ||
78 | 3 | +++ b/include/grail-types.h 2011-03-28 20:04:07 +0000 | ||
79 | 4 | @@ -59,11 +59,20 @@ | ||
80 | 5 | |||
81 | 6 | #define GRAIL_TYPE_SYSFLAG1 26 /* reserved system flag */ | ||
82 | 7 | |||
83 | 8 | +#define GRAIL_TYPE_TOUCH1 32 /* one-finger touch */ | ||
84 | 9 | +#define GRAIL_TYPE_TOUCH2 33 /* two-finger touch */ | ||
85 | 10 | +#define GRAIL_TYPE_TOUCH3 34 /* three-finger touch */ | ||
86 | 11 | +#define GRAIL_TYPE_TOUCH4 35 /* four-finger touch */ | ||
87 | 12 | +#define GRAIL_TYPE_TOUCH5 36 /* five-finger touch */ | ||
88 | 13 | +#define GRAIL_TYPE_ETOUCH 37 /* three-finger environment touch */ | ||
89 | 14 | +#define GRAIL_TYPE_MTOUCH 38 /* four-finger meta touch */ | ||
90 | 15 | + | ||
91 | 16 | #define GRAIL_MAIN_DRAG 0 | ||
92 | 17 | #define GRAIL_MAIN_PINCH 1 | ||
93 | 18 | #define GRAIL_MAIN_ROTATE 2 | ||
94 | 19 | #define GRAIL_MAIN_TAP 3 | ||
95 | 20 | #define GRAIL_MAIN_SYSFLAG 4 | ||
96 | 21 | +#define GRAIL_MAIN_TOUCH 5 | ||
97 | 22 | |||
98 | 23 | #define GRAIL_PROP_DRAG_DX 0 /* horizontal position delta */ | ||
99 | 24 | #define GRAIL_PROP_DRAG_DY 1 /* vertical position delta */ | ||
100 | 25 | @@ -160,5 +169,24 @@ | ||
101 | 26 | #define GRAIL_PROP_TAP_X_T4 20 | ||
102 | 27 | #define GRAIL_PROP_TAP_Y_T4 21 | ||
103 | 28 | |||
104 | 29 | +#define GRAIL_PROP_TOUCH_X1 0 /* bounding box x1 */ | ||
105 | 30 | +#define GRAIL_PROP_TOUCH_Y1 1 /* bounding box y1 */ | ||
106 | 31 | +#define GRAIL_PROP_TOUCH_X2 2 /* bounding box x2 */ | ||
107 | 32 | +#define GRAIL_PROP_TOUCH_Y2 3 /* bounding box y2 */ | ||
108 | 33 | +#define GRAIL_PROP_TOUCH_ID_T0 4 /* first touch id */ | ||
109 | 34 | +#define GRAIL_PROP_TOUCH_X_T0 5 /* first touch horizontal position */ | ||
110 | 35 | +#define GRAIL_PROP_TOUCH_Y_T0 6 /* first touch vertical position */ | ||
111 | 36 | +#define GRAIL_PROP_TOUCH_ID_T1 7 | ||
112 | 37 | +#define GRAIL_PROP_TOUCH_X_T1 8 | ||
113 | 38 | +#define GRAIL_PROP_TOUCH_Y_T1 9 | ||
114 | 39 | +#define GRAIL_PROP_TOUCH_ID_T2 10 | ||
115 | 40 | +#define GRAIL_PROP_TOUCH_X_T2 11 | ||
116 | 41 | +#define GRAIL_PROP_TOUCH_Y_T2 12 | ||
117 | 42 | +#define GRAIL_PROP_TOUCH_ID_T3 13 | ||
118 | 43 | +#define GRAIL_PROP_TOUCH_X_T3 14 | ||
119 | 44 | +#define GRAIL_PROP_TOUCH_Y_T3 15 | ||
120 | 45 | +#define GRAIL_PROP_TOUCH_ID_T4 16 | ||
121 | 46 | +#define GRAIL_PROP_TOUCH_X_T4 17 | ||
122 | 47 | +#define GRAIL_PROP_TOUCH_Y_T4 18 | ||
123 | 48 | |||
124 | 49 | #endif | ||
125 | 50 | |||
126 | 51 | === modified file 'src/Makefile.am' | ||
127 | 52 | --- a/src/Makefile.am 2011-01-02 12:08:42 +0000 | ||
128 | 53 | +++ b/src/Makefile.am 2011-03-28 20:04:07 +0000 | ||
129 | 54 | @@ -17,6 +17,7 @@ | ||
130 | 55 | grail-inserter.h \ | ||
131 | 56 | grail-gestures.c \ | ||
132 | 57 | grail-gestures.h \ | ||
133 | 58 | + gestures-touch.c \ | ||
134 | 59 | gestures-drag.c \ | ||
135 | 60 | gestures-pinch.c \ | ||
136 | 61 | gestures-rotate.c \ | ||
137 | 62 | |||
138 | 63 | === modified file 'src/Makefile.in' | ||
139 | 64 | --- a/src/Makefile.in 2011-01-03 16:00:56 +0000 | ||
140 | 65 | +++ b/src/Makefile.in 2011-03-28 20:48:57 +0000 | ||
141 | 66 | @@ -72,9 +72,9 @@ | ||
142 | 67 | LTLIBRARIES = $(lib_LTLIBRARIES) | ||
143 | 68 | libutouch_grail_la_LIBADD = | ||
144 | 69 | am_libutouch_grail_la_OBJECTS = grail-bits.lo grail-inserter.lo \ | ||
145 | 70 | - grail-gestures.lo gestures-drag.lo gestures-pinch.lo \ | ||
146 | 71 | - gestures-rotate.lo gestures-tapping.lo grail-recognizer.lo \ | ||
147 | 72 | - grail-event.lo grail-api.lo | ||
148 | 73 | + grail-gestures.lo gestures-touch.lo gestures-drag.lo \ | ||
149 | 74 | + gestures-pinch.lo gestures-rotate.lo gestures-tapping.lo \ | ||
150 | 75 | + grail-recognizer.lo grail-event.lo grail-api.lo | ||
151 | 76 | libutouch_grail_la_OBJECTS = $(am_libutouch_grail_la_OBJECTS) | ||
152 | 77 | libutouch_grail_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ | ||
153 | 78 | $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ | ||
154 | 79 | @@ -238,6 +238,7 @@ | ||
155 | 80 | grail-inserter.h \ | ||
156 | 81 | grail-gestures.c \ | ||
157 | 82 | grail-gestures.h \ | ||
158 | 83 | + gestures-touch.c \ | ||
159 | 84 | gestures-drag.c \ | ||
160 | 85 | gestures-pinch.c \ | ||
161 | 86 | gestures-rotate.c \ | ||
162 | 87 | @@ -334,6 +335,7 @@ | ||
163 | 88 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gestures-pinch.Plo@am__quote@ | ||
164 | 89 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gestures-rotate.Plo@am__quote@ | ||
165 | 90 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gestures-tapping.Plo@am__quote@ | ||
166 | 91 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gestures-touch.Plo@am__quote@ | ||
167 | 92 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grail-api.Plo@am__quote@ | ||
168 | 93 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grail-bits.Plo@am__quote@ | ||
169 | 94 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grail-event.Plo@am__quote@ | ||
170 | 95 | |||
171 | 96 | === modified file 'src/gestures-drag.c' | ||
172 | 97 | --- a/src/gestures-drag.c 2011-03-17 09:48:13 +0000 | ||
173 | 98 | +++ b/src/gestures-drag.c 2011-03-28 20:04:18 +0000 | ||
174 | 99 | @@ -70,10 +70,8 @@ | ||
175 | 100 | } | ||
176 | 101 | if ((move->timeout & fm_mask) == fm_mask) { | ||
177 | 102 | if (state->active) { | ||
178 | 103 | - gin_gid_discard(ge, state->gid); | ||
179 | 104 | - state->active = 0; | ||
180 | 105 | + gin_gid_timeout(ge, state->gid); | ||
181 | 106 | } | ||
182 | 107 | - return 0; | ||
183 | 108 | } | ||
184 | 109 | if (!state->active) { | ||
185 | 110 | int type = getype[move->ntouch]; | ||
186 | 111 | @@ -84,7 +82,7 @@ | ||
187 | 112 | } | ||
188 | 113 | if (!(move->tickle & mask)) | ||
189 | 114 | return 0; | ||
190 | 115 | - if (!move->single && !(move->active & fm_mask)) | ||
191 | 116 | + if (!(move->active & fm_mask)) | ||
192 | 117 | return 0; | ||
193 | 118 | set_props(ge->gin, state, move, frame); | ||
194 | 119 | gru_event(ge, state->gid, move, state->prop, state->nprop); | ||
195 | 120 | @@ -107,10 +105,8 @@ | ||
196 | 121 | } | ||
197 | 122 | if ((move->timeout & fm_mask) == fm_mask) { | ||
198 | 123 | if (state->active) { | ||
199 | 124 | - gin_gid_discard(ge, state->gid); | ||
200 | 125 | - state->active = 0; | ||
201 | 126 | + gin_gid_timeout(ge, state->gid); | ||
202 | 127 | } | ||
203 | 128 | - return 0; | ||
204 | 129 | } | ||
205 | 130 | if (!state->active) { | ||
206 | 131 | if (move->ntouch == 4) { | ||
207 | 132 | @@ -131,7 +127,7 @@ | ||
208 | 133 | } | ||
209 | 134 | if (!(move->tickle & mask)) | ||
210 | 135 | return 0; | ||
211 | 136 | - if (!move->single && !(move->active & fm_mask)) | ||
212 | 137 | + if (!(move->active & fm_mask)) | ||
213 | 138 | return 0; | ||
214 | 139 | set_props(ge->gin, state, move, frame); | ||
215 | 140 | gru_event(ge, state->gid, move, state->prop, state->nprop); | ||
216 | 141 | |||
217 | 142 | === modified file 'src/gestures-pinch.c' | ||
218 | 143 | --- a/src/gestures-pinch.c 2011-03-17 09:48:13 +0000 | ||
219 | 144 | +++ b/src/gestures-pinch.c 2011-03-28 20:04:11 +0000 | ||
220 | 145 | @@ -64,10 +64,8 @@ | ||
221 | 146 | } | ||
222 | 147 | if ((move->timeout & fm_mask) == fm_mask) { | ||
223 | 148 | if (state->active) { | ||
224 | 149 | - gin_gid_discard(ge, state->gid); | ||
225 | 150 | - state->active = 0; | ||
226 | 151 | + gin_gid_timeout(ge, state->gid); | ||
227 | 152 | } | ||
228 | 153 | - return 0; | ||
229 | 154 | } | ||
230 | 155 | if (!(move->tickle & mask)) | ||
231 | 156 | return 0; | ||
232 | 157 | @@ -102,10 +100,8 @@ | ||
233 | 158 | } | ||
234 | 159 | if ((move->timeout & fm_mask) == fm_mask) { | ||
235 | 160 | if (state->active) { | ||
236 | 161 | - gin_gid_discard(ge, state->gid); | ||
237 | 162 | - state->active = 0; | ||
238 | 163 | + gin_gid_timeout(ge, state->gid); | ||
239 | 164 | } | ||
240 | 165 | - return 0; | ||
241 | 166 | } | ||
242 | 167 | if (!(move->tickle & mask)) | ||
243 | 168 | return 0; | ||
244 | 169 | |||
245 | 170 | === modified file 'src/gestures-rotate.c' | ||
246 | 171 | --- a/src/gestures-rotate.c 2011-02-24 22:51:33 +0000 | ||
247 | 172 | +++ b/src/gestures-rotate.c 2011-03-28 20:04:11 +0000 | ||
248 | 173 | @@ -63,10 +63,8 @@ | ||
249 | 174 | } | ||
250 | 175 | if ((move->timeout & fm_mask) == fm_mask) { | ||
251 | 176 | if (state->active) { | ||
252 | 177 | - gin_gid_discard(ge, state->gid); | ||
253 | 178 | - state->active = 0; | ||
254 | 179 | + gin_gid_timeout(ge, state->gid); | ||
255 | 180 | } | ||
256 | 181 | - return 0; | ||
257 | 182 | } | ||
258 | 183 | if (!(move->tickle & mask)) | ||
259 | 184 | return 0; | ||
260 | 185 | @@ -101,10 +99,8 @@ | ||
261 | 186 | } | ||
262 | 187 | if ((move->timeout & fm_mask) == fm_mask) { | ||
263 | 188 | if (state->active) { | ||
264 | 189 | - gin_gid_discard(ge, state->gid); | ||
265 | 190 | - state->active = 0; | ||
266 | 191 | + gin_gid_timeout(ge, state->gid); | ||
267 | 192 | } | ||
268 | 193 | - return 0; | ||
269 | 194 | } | ||
270 | 195 | if (!(move->tickle & mask)) | ||
271 | 196 | return 0; | ||
272 | 197 | |||
273 | 198 | === added file 'src/gestures-touch.c' | ||
274 | 199 | --- a/src/gestures-touch.c 1970-01-01 00:00:00 +0000 | ||
275 | 200 | +++ b/src/gestures-touch.c 2011-03-28 20:04:07 +0000 | ||
276 | 201 | @@ -0,0 +1,94 @@ | ||
277 | 202 | +/***************************************************************************** | ||
278 | 203 | + * | ||
279 | 204 | + * grail - Gesture Recognition And Instantiation Library | ||
280 | 205 | + * | ||
281 | 206 | + * Copyright (C) 2010 Canonical Ltd. | ||
282 | 207 | + * Copyright (C) 2010 Henrik Rydberg <rydberg@bitmath.org> | ||
283 | 208 | + * | ||
284 | 209 | + * This program is free software: you can redistribute it and/or modify it | ||
285 | 210 | + * under the terms of the GNU General Public License as published by the | ||
286 | 211 | + * Free Software Foundation, either version 3 of the License, or (at your | ||
287 | 212 | + * option) any later version. | ||
288 | 213 | + * | ||
289 | 214 | + * This program is distributed in the hope that it will be useful, but | ||
290 | 215 | + * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
291 | 216 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
292 | 217 | + * General Public License for more details. | ||
293 | 218 | + * | ||
294 | 219 | + * You should have received a copy of the GNU General Public License along | ||
295 | 220 | + * with this program. If not, see <http://www.gnu.org/licenses/>. | ||
296 | 221 | + * | ||
297 | 222 | + ****************************************************************************/ | ||
298 | 223 | + | ||
299 | 224 | +#include "grail-recognizer.h" | ||
300 | 225 | +#include <math.h> | ||
301 | 226 | +#include <stdio.h> | ||
302 | 227 | + | ||
303 | 228 | +static const int getype[DIM_TOUCH + 1] = { | ||
304 | 229 | + -1, | ||
305 | 230 | + GRAIL_TYPE_TOUCH1, | ||
306 | 231 | + GRAIL_TYPE_TOUCH2, | ||
307 | 232 | + GRAIL_TYPE_TOUCH3, | ||
308 | 233 | + GRAIL_TYPE_TOUCH4, | ||
309 | 234 | + GRAIL_TYPE_TOUCH5, | ||
310 | 235 | +}; | ||
311 | 236 | + | ||
312 | 237 | +int gru_touch(struct grail *ge, | ||
313 | 238 | + const struct utouch_frame *frame) | ||
314 | 239 | +{ | ||
315 | 240 | + struct gesture_recognizer *gru = ge->gru; | ||
316 | 241 | + struct combo_model *state = &gru->touch; | ||
317 | 242 | + struct move_model *move = &gru->move; | ||
318 | 243 | + if (frame->slot_revision != frame->prev->slot_revision) { | ||
319 | 244 | + if (state->active) { | ||
320 | 245 | + gru_end(ge, state->gid, move, | ||
321 | 246 | + state->prop, state->nprop); | ||
322 | 247 | + state->active = 0; | ||
323 | 248 | + } | ||
324 | 249 | + } | ||
325 | 250 | + if (!state->active) { | ||
326 | 251 | + int type = getype[move->ntouch]; | ||
327 | 252 | + if (type <= 0) | ||
328 | 253 | + return 0; | ||
329 | 254 | + state->gid = gin_gid_begin(ge, type, -PRIO_GESTURE, frame); | ||
330 | 255 | + state->active = 1; | ||
331 | 256 | + } | ||
332 | 257 | + state->nprop = gin_add_contact_props(ge->gin, state->prop, frame); | ||
333 | 258 | + gru_event(ge, state->gid, move, state->prop, state->nprop); | ||
334 | 259 | + return 1; | ||
335 | 260 | +} | ||
336 | 261 | + | ||
337 | 262 | +int gru_wintouch(struct grail *ge, | ||
338 | 263 | + const struct utouch_frame *frame) | ||
339 | 264 | +{ | ||
340 | 265 | + struct gesture_recognizer *gru = ge->gru; | ||
341 | 266 | + struct combo_model *state = &gru->wintouch; | ||
342 | 267 | + struct move_model *move = &gru->move; | ||
343 | 268 | + if (frame->slot_revision != frame->prev->slot_revision) { | ||
344 | 269 | + if (state->active && out_of_bounds(state, move)) { | ||
345 | 270 | + gru_end(ge, state->gid, move, | ||
346 | 271 | + state->prop, state->nprop); | ||
347 | 272 | + state->active = 0; | ||
348 | 273 | + } | ||
349 | 274 | + } | ||
350 | 275 | + if (!state->active) { | ||
351 | 276 | + if (move->ntouch == 4) { | ||
352 | 277 | + state->gid = gin_gid_begin(ge, GRAIL_TYPE_MTOUCH, | ||
353 | 278 | + -PRIO_META, frame); | ||
354 | 279 | + state->mintouch = 1; | ||
355 | 280 | + state->maxtouch = 4; | ||
356 | 281 | + state->active = 1; | ||
357 | 282 | + } else if (move->ntouch == 3) { | ||
358 | 283 | + state->gid = gin_gid_begin(ge, GRAIL_TYPE_ETOUCH, | ||
359 | 284 | + -PRIO_ENV, frame); | ||
360 | 285 | + state->mintouch = 1; | ||
361 | 286 | + state->maxtouch = 3; | ||
362 | 287 | + state->active = 1; | ||
363 | 288 | + } else { | ||
364 | 289 | + return 0; | ||
365 | 290 | + } | ||
366 | 291 | + } | ||
367 | 292 | + state->nprop = gin_add_contact_props(ge->gin, state->prop, frame); | ||
368 | 293 | + gru_event(ge, state->gid, move, state->prop, state->nprop); | ||
369 | 294 | + return 1; | ||
370 | 295 | +} | ||
371 | 296 | |||
372 | 297 | === modified file 'src/grail-gestures.c' | ||
373 | 298 | --- a/src/grail-gestures.c 2011-03-17 09:48:13 +0000 | ||
374 | 299 | +++ b/src/grail-gestures.c 2011-03-28 20:04:16 +0000 | ||
375 | 300 | @@ -133,15 +133,14 @@ | ||
376 | 301 | m->tickle &= ~(1 << i); | ||
377 | 302 | if (m->active & (1 << i)) | ||
378 | 303 | return; | ||
379 | 304 | - fm->action_delta = x - fm->original; | ||
380 | 305 | - if (t - fm->original_ms > fm->hold_ms && | ||
381 | 306 | - fabs(fm->action_delta) > fm->bar) { | ||
382 | 307 | - m->active |= (1 << i); | ||
383 | 308 | + fm->action_delta = 0; | ||
384 | 309 | + if (fabs(x - fm->original) > fm->bar) { | ||
385 | 310 | + if (t - fm->original_ms > fm->hold_ms) { | ||
386 | 311 | + m->active |= (1 << i); | ||
387 | 312 | + fm->action_delta = x - fm->original; | ||
388 | 313 | + } | ||
389 | 314 | } else if (t - fm->original_ms > fm->bar_ms) { | ||
390 | 315 | - m->active |= (1 << i); | ||
391 | 316 | m->timeout |= (1 << i); | ||
392 | 317 | - } else { | ||
393 | 318 | - fm->action_delta = 0; | ||
394 | 319 | } | ||
395 | 320 | } | ||
396 | 321 | |||
397 | 322 | |||
398 | 323 | === modified file 'src/grail-gestures.h' | ||
399 | 324 | --- a/src/grail-gestures.h 2011-02-24 22:51:17 +0000 | ||
400 | 325 | +++ b/src/grail-gestures.h 2011-03-28 20:04:07 +0000 | ||
401 | 326 | @@ -77,6 +77,8 @@ | ||
402 | 327 | grail_prop_t prop[DIM_GRAIL_PROP]; | ||
403 | 328 | }; | ||
404 | 329 | |||
405 | 330 | +int gru_touch(struct grail *ge, | ||
406 | 331 | + const struct utouch_frame *frame); | ||
407 | 332 | int gru_drag(struct grail *ge, | ||
408 | 333 | const struct utouch_frame *frame); | ||
409 | 334 | int gru_pinch(struct grail *ge, | ||
410 | 335 | @@ -90,6 +92,8 @@ | ||
411 | 336 | return m->ntouch < s->mintouch || m->ntouch > s->maxtouch; | ||
412 | 337 | } | ||
413 | 338 | |||
414 | 339 | +int gru_wintouch(struct grail *ge, | ||
415 | 340 | + const struct utouch_frame *frame); | ||
416 | 341 | int gru_windrag(struct grail *ge, | ||
417 | 342 | const struct utouch_frame *frame); | ||
418 | 343 | int gru_winpinch(struct grail *ge, | ||
419 | 344 | |||
420 | 345 | === modified file 'src/grail-inserter.c' | ||
421 | 346 | --- a/src/grail-inserter.c 2011-03-17 09:48:13 +0000 | ||
422 | 347 | +++ b/src/grail-inserter.c 2011-03-28 20:04:13 +0000 | ||
423 | 348 | @@ -38,6 +38,18 @@ | ||
424 | 349 | return -1; | ||
425 | 350 | } | ||
426 | 351 | |||
427 | 352 | +static int mask_overlap(const grail_mask_t *a, const grail_mask_t *b, | ||
428 | 353 | + int bytes) | ||
429 | 354 | +{ | ||
430 | 355 | + int i; | ||
431 | 356 | + | ||
432 | 357 | + for (i = 0; i < bytes; i++) | ||
433 | 358 | + if (a[i] & b[i]) | ||
434 | 359 | + return 1; | ||
435 | 360 | + | ||
436 | 361 | + return 0; | ||
437 | 362 | +} | ||
438 | 363 | + | ||
439 | 364 | // todo: spanning tree for multi-user case | ||
440 | 365 | static void setup_new_gestures(struct grail *ge, | ||
441 | 366 | const struct utouch_frame *frame) | ||
442 | 367 | @@ -114,33 +126,50 @@ | ||
443 | 368 | void gin_frame_end(struct grail *ge, const struct utouch_frame *frame) | ||
444 | 369 | { | ||
445 | 370 | struct gesture_inserter *gin = ge->gin; | ||
446 | 371 | - int i, hold = 0, discard = 0; | ||
447 | 372 | + grail_mask_t keep[DIM_TOUCH_BYTES]; | ||
448 | 373 | + int i, hold[2] = { 0, 0 }, discard[2] = { 0, 0 }; | ||
449 | 374 | |||
450 | 375 | + memset(keep, 0, sizeof(keep)); | ||
451 | 376 | setup_new_gestures(ge, frame); | ||
452 | 377 | |||
453 | 378 | grail_mask_foreach(i, gin->used, sizeof(gin->used)) { | ||
454 | 379 | struct slot_state *s = &gin->state[i]; | ||
455 | 380 | if (!s->nclient) | ||
456 | 381 | continue; | ||
457 | 382 | - if (s->priority > hold) | ||
458 | 383 | - hold = s->priority; | ||
459 | 384 | + if (s->priority > hold[s->slice]) | ||
460 | 385 | + hold[s->slice] = s->priority; | ||
461 | 386 | if (s->status != GRAIL_STATUS_UPDATE) | ||
462 | 387 | continue; | ||
463 | 388 | - if (s->priority > discard) | ||
464 | 389 | - discard = s->priority; | ||
465 | 390 | + if (s->priority > discard[s->slice]) | ||
466 | 391 | + discard[s->slice] = s->priority; | ||
467 | 392 | } | ||
468 | 393 | |||
469 | 394 | grail_mask_foreach(i, gin->used, sizeof(gin->used)) { | ||
470 | 395 | struct slot_state *s = &gin->state[i]; | ||
471 | 396 | - if (!s->nclient || s->priority < discard) | ||
472 | 397 | + if (!s->nclient || s->priority < discard[s->slice]) | ||
473 | 398 | gin_gid_discard(ge, s->id); | ||
474 | 399 | } | ||
475 | 400 | |||
476 | 401 | grail_mask_foreach(i, gin->used, sizeof(gin->used)) { | ||
477 | 402 | struct slot_state *s = &gin->state[i]; | ||
478 | 403 | + if (s->slice == 1) | ||
479 | 404 | + grail_mask_set_mask(keep, s->span, sizeof(keep)); | ||
480 | 405 | + } | ||
481 | 406 | + | ||
482 | 407 | + grail_mask_foreach(i, gin->used, sizeof(gin->used)) { | ||
483 | 408 | + struct slot_state *s = &gin->state[i]; | ||
484 | 409 | + if (!s->timeout) | ||
485 | 410 | + continue; | ||
486 | 411 | + if (mask_overlap(keep, s->span, sizeof(keep))) | ||
487 | 412 | + continue; | ||
488 | 413 | + gin_gid_discard(ge, s->id); | ||
489 | 414 | + } | ||
490 | 415 | + | ||
491 | 416 | + grail_mask_foreach(i, gin->used, sizeof(gin->used)) { | ||
492 | 417 | + struct slot_state *s = &gin->state[i]; | ||
493 | 418 | struct gesture_event ev; | ||
494 | 419 | grail_mask_set(gin->types, s->type); | ||
495 | 420 | - if (s->priority < hold) | ||
496 | 421 | + if (s->priority < hold[s->slice]) | ||
497 | 422 | continue; | ||
498 | 423 | while (!gebuf_empty(&s->buf)) { | ||
499 | 424 | gebuf_get(&s->buf, &ev); | ||
500 | 425 | @@ -166,7 +195,14 @@ | ||
501 | 426 | return -1; | ||
502 | 427 | s = &gin->state[i]; | ||
503 | 428 | s->type = type; | ||
504 | 429 | - s->priority = priority; | ||
505 | 430 | + if (priority < 0) { | ||
506 | 431 | + s->priority = -priority; | ||
507 | 432 | + s->slice = 1; | ||
508 | 433 | + } else { | ||
509 | 434 | + s->priority = priority; | ||
510 | 435 | + s->slice = 0; | ||
511 | 436 | + } | ||
512 | 437 | + s->timeout = 0; | ||
513 | 438 | s->id = gin->gestureid++ & MAX_GESTURE_ID; | ||
514 | 439 | s->status = GRAIL_STATUS_BEGIN; | ||
515 | 440 | s->nclient = 0; | ||
516 | 441 | @@ -193,6 +229,13 @@ | ||
517 | 442 | grail_mask_set(gin->unused, i); | ||
518 | 443 | } | ||
519 | 444 | |||
520 | 445 | +void gin_gid_timeout(struct grail *ge, int gid) | ||
521 | 446 | +{ | ||
522 | 447 | + int i = find_gslot(ge->gin, gid); | ||
523 | 448 | + if (i >= 0) | ||
524 | 449 | + ge->gin->state[i].timeout = 1; | ||
525 | 450 | +} | ||
526 | 451 | + | ||
527 | 452 | void gin_gid_event(struct grail *ge, int gid, | ||
528 | 453 | float x, float y, int ntouch, | ||
529 | 454 | const grail_prop_t *prop, int nprop, | ||
530 | 455 | |||
531 | 456 | === modified file 'src/grail-inserter.h' | ||
532 | 457 | --- a/src/grail-inserter.h 2011-03-17 09:48:13 +0000 | ||
533 | 458 | +++ b/src/grail-inserter.h 2011-03-28 20:04:11 +0000 | ||
534 | 459 | @@ -37,6 +37,8 @@ | ||
535 | 460 | struct slot_state { | ||
536 | 461 | int type; | ||
537 | 462 | int priority; | ||
538 | 463 | + int slice; | ||
539 | 464 | + int timeout; | ||
540 | 465 | int id; | ||
541 | 466 | int status; | ||
542 | 467 | int nclient; | ||
543 | 468 | @@ -78,6 +80,7 @@ | ||
544 | 469 | int gin_gid_begin(struct grail *ge, int type, int priority, | ||
545 | 470 | const struct utouch_frame *frame); | ||
546 | 471 | void gin_gid_discard(struct grail *ge, int gid); | ||
547 | 472 | +void gin_gid_timeout(struct grail *ge, int gid); | ||
548 | 473 | |||
549 | 474 | void gin_gid_event(struct grail *ge, int gid, | ||
550 | 475 | float x, float y, int ntouch, | ||
551 | 476 | |||
552 | 477 | === modified file 'src/grail-recognizer.c' | ||
553 | 478 | --- a/src/grail-recognizer.c 2011-01-02 12:08:08 +0000 | ||
554 | 479 | +++ b/src/grail-recognizer.c 2011-03-28 20:04:07 +0000 | ||
555 | 480 | @@ -47,9 +47,11 @@ | ||
556 | 481 | if (!ge->gin || !ge->gru) | ||
557 | 482 | return; | ||
558 | 483 | gru_motion(ge, frame); | ||
559 | 484 | + gru_touch(ge, frame); | ||
560 | 485 | gru_drag(ge, frame); | ||
561 | 486 | gru_pinch(ge, frame); | ||
562 | 487 | gru_rotate(ge, frame); | ||
563 | 488 | + gru_wintouch(ge, frame); | ||
564 | 489 | gru_windrag(ge, frame); | ||
565 | 490 | gru_winpinch(ge, frame); | ||
566 | 491 | gru_winrotate(ge, frame); | ||
567 | 492 | |||
568 | 493 | === modified file 'src/grail-recognizer.h' | ||
569 | 494 | --- a/src/grail-recognizer.h 2011-02-24 22:49:22 +0000 | ||
570 | 495 | +++ b/src/grail-recognizer.h 2011-03-28 20:04:07 +0000 | ||
571 | 496 | @@ -27,9 +27,11 @@ | ||
572 | 497 | |||
573 | 498 | struct gesture_recognizer { | ||
574 | 499 | struct move_model move; | ||
575 | 500 | + struct combo_model touch; | ||
576 | 501 | struct combo_model drag; | ||
577 | 502 | struct combo_model pinch; | ||
578 | 503 | struct combo_model rotate; | ||
579 | 504 | + struct combo_model wintouch; | ||
580 | 505 | struct combo_model windrag; | ||
581 | 506 | struct combo_model winpinch; | ||
582 | 507 | struct combo_model winrotate; | ||
583 | 508 | |||
584 | 0 | 509 | ||
585 | === added file 'debian/patches/0004-dont-hold-back-active-gestures.patch' | |||
586 | --- debian/patches/0004-dont-hold-back-active-gestures.patch 1970-01-01 00:00:00 +0000 | |||
587 | +++ debian/patches/0004-dont-hold-back-active-gestures.patch 2011-03-30 15:42:36 +0000 | |||
588 | @@ -0,0 +1,48 @@ | |||
589 | 1 | === modified file 'src/grail-inserter.c' | ||
590 | 2 | --- a/src/grail-inserter.c 2011-03-28 20:04:13 +0000 | ||
591 | 3 | +++ b/src/grail-inserter.c 2011-03-30 15:37:59 +0000 | ||
592 | 4 | @@ -146,7 +146,7 @@ | ||
593 | 5 | |||
594 | 6 | grail_mask_foreach(i, gin->used, sizeof(gin->used)) { | ||
595 | 7 | struct slot_state *s = &gin->state[i]; | ||
596 | 8 | - if (!s->nclient || s->priority < discard[s->slice]) | ||
597 | 9 | + if (!s->nclient || s->priority < discard[s->slice] && !s->sent) | ||
598 | 10 | gin_gid_discard(ge, s->id); | ||
599 | 11 | } | ||
600 | 12 | |||
601 | 13 | @@ -169,12 +169,13 @@ | ||
602 | 14 | struct slot_state *s = &gin->state[i]; | ||
603 | 15 | struct gesture_event ev; | ||
604 | 16 | grail_mask_set(gin->types, s->type); | ||
605 | 17 | - if (s->priority < hold[s->slice]) | ||
606 | 18 | + if (s->priority < hold[s->slice] && !s->sent) | ||
607 | 19 | continue; | ||
608 | 20 | while (!gebuf_empty(&s->buf)) { | ||
609 | 21 | gebuf_get(&s->buf, &ev); | ||
610 | 22 | gin_send_event(ge, s, &ev, frame); | ||
611 | 23 | } | ||
612 | 24 | + s->sent = 1; | ||
613 | 25 | } | ||
614 | 26 | |||
615 | 27 | grail_mask_foreach(i, gin->used, sizeof(gin->used)) { | ||
616 | 28 | @@ -203,6 +204,7 @@ | ||
617 | 29 | s->slice = 0; | ||
618 | 30 | } | ||
619 | 31 | s->timeout = 0; | ||
620 | 32 | + s->sent = 0; | ||
621 | 33 | s->id = gin->gestureid++ & MAX_GESTURE_ID; | ||
622 | 34 | s->status = GRAIL_STATUS_BEGIN; | ||
623 | 35 | s->nclient = 0; | ||
624 | 36 | |||
625 | 37 | === modified file 'src/grail-inserter.h' | ||
626 | 38 | --- a/src/grail-inserter.h 2011-03-28 20:04:11 +0000 | ||
627 | 39 | +++ b/src/grail-inserter.h 2011-03-30 15:37:20 +0000 | ||
628 | 40 | @@ -39,6 +39,7 @@ | ||
629 | 41 | int priority; | ||
630 | 42 | int slice; | ||
631 | 43 | int timeout; | ||
632 | 44 | + int sent; | ||
633 | 45 | int id; | ||
634 | 46 | int status; | ||
635 | 47 | int nclient; | ||
636 | 48 | |||
637 | 0 | 49 | ||
638 | === added file 'debian/patches/series' | |||
639 | --- debian/patches/series 1970-01-01 00:00:00 +0000 | |||
640 | +++ debian/patches/series 2011-03-30 15:42:36 +0000 | |||
641 | @@ -0,0 +1,4 @@ | |||
642 | 1 | 0001-set-proper-tap-properties.patch | ||
643 | 2 | 0002-disable-semi-mt-rotation.patch | ||
644 | 3 | 0003-add-touch-gestures.patch | ||
645 | 4 | 0004-dont-hold-back-active-gestures.patch |
We have reached consensus on everything but the much less important semi-mt change. I just cant be bothered with anymore discussions around it. Adding the disputed change to this critical set is bad style. Have fun with it.