Merge lp:~oif-packaging/grail/packaging.v1.0.20 into lp:grail/ubuntu
- packaging.v1.0.20
- Merge into packaging
Proposed by
Henrik Rydberg
Status: | Merged |
---|---|
Approved by: | Chase Douglas |
Approved revision: | 78 |
Merged at revision: | 77 |
Proposed branch: | lp:~oif-packaging/grail/packaging.v1.0.20 |
Merge into: | lp:grail/ubuntu |
Diff against target: |
932 lines (+324/-215) 18 files modified
ChangeLog (+131/-0) config-aux/ltmain.sh (+2/-2) configure (+10/-10) configure.ac (+1/-1) debian/changelog (+7/-0) src/evbuf.h (+1/-1) src/gestures-drag.c (+14/-0) src/gestures-pinch.c (+15/-1) src/gestures-rotate.c (+15/-1) src/gestures-tapping.c (+6/-2) src/grail-api.c (+90/-162) src/grail-event.c (+2/-16) src/grail-gestures.c (+14/-7) src/grail-gestures.h (+3/-2) src/grail-impl.h (+2/-0) src/grail-inserter.c (+9/-0) src/grail-inserter.h (+2/-0) src/grail-recognizer.h (+0/-10) |
To merge this branch: | bzr merge lp:~oif-packaging/grail/packaging.v1.0.20 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Chase Douglas (community) | Approve | ||
Review via email: mp+52704@code.launchpad.net |
Commit message
Description of the change
This changeset fixes LP: #637106, and a couple of minor issues without bug reports.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'ChangeLog' |
2 | --- ChangeLog 2011-02-21 19:59:40 +0000 |
3 | +++ ChangeLog 2011-03-09 15:59:59 +0000 |
4 | @@ -1,5 +1,136 @@ |
5 | ------------------------------------------------------------ |
6 | +revno: 126 |
7 | +tags: v1.0.20 |
8 | +committer: Henrik Rydberg <rydberg@bitmath.org> |
9 | +branch nick: trunk |
10 | +timestamp: Fri 2011-03-04 01:05:19 +0100 |
11 | +message: |
12 | + Bump to v1.0.20 |
13 | +------------------------------------------------------------ |
14 | +revno: 125 |
15 | +committer: Henrik Rydberg <rydberg@bitmath.org> |
16 | +branch nick: trunk |
17 | +timestamp: Fri 2011-03-04 01:04:55 +0100 |
18 | +message: |
19 | + Make grabbing client exclusive |
20 | + |
21 | + When a possible gesture is started for a global client (sysflag set), |
22 | + it is desirable that gestures to other clients are disregarded until |
23 | + all contacts have left the surface. In principle this could be refined |
24 | + further, such that if gesture are not detected, they are passed on to |
25 | + other clients, but that also affects how touches are passed onto lower |
26 | + layers like XI2.1, so simply making sure a global system client gets |
27 | + all events potentially leading to gestures is good enough for now. |
28 | + |
29 | + Also note that in the current combination of synaptics/evdev X servers |
30 | + and grail, there can be no overlapping potential gestures between two |
31 | + global clients, or the resulting event recipient is not correct. |
32 | +------------------------------------------------------------ |
33 | +revno: 124 |
34 | +committer: Henrik Rydberg <rydberg@bitmath.org> |
35 | +branch nick: trunk |
36 | +timestamp: Thu 2011-02-24 23:51:33 +0100 |
37 | +message: |
38 | + Make reset logic of pinch and drag same as for drag |
39 | + |
40 | + There is no direct reason for one-fingered pinch/rotate gestures |
41 | + to be discarded immediately, so only reset gestures on touch down, |
42 | + as for drags. |
43 | +------------------------------------------------------------ |
44 | +revno: 123 |
45 | +committer: Henrik Rydberg <rydberg@bitmath.org> |
46 | +branch nick: trunk |
47 | +timestamp: Thu 2011-02-24 23:51:17 +0100 |
48 | +message: |
49 | + Remove unused tapping state |
50 | + |
51 | + This patch removes some cruft that was left over from the |
52 | + removal of the short tap time logic. |
53 | +------------------------------------------------------------ |
54 | +revno: 122 |
55 | +committer: Henrik Rydberg <rydberg@bitmath.org> |
56 | +branch nick: trunk |
57 | +timestamp: Thu 2011-02-24 23:50:59 +0100 |
58 | +message: |
59 | + Reset tap state after timeout |
60 | + |
61 | + A touch and hold will not properly reset the tap state, such that |
62 | + the next tap fails to register. Fixed with this patch. |
63 | +------------------------------------------------------------ |
64 | +revno: 121 |
65 | +committer: Henrik Rydberg <rydberg@bitmath.org> |
66 | +branch nick: trunk |
67 | +timestamp: Thu 2011-02-24 23:50:31 +0100 |
68 | +message: |
69 | + Adjust gesture buffer sizes and timings |
70 | + |
71 | + Adjust timings to put drag, pinch and rotate on more equal footing, |
72 | + with regard to gesture timeouts. Also make sure events are not lost |
73 | + during hold, now that all MT events are buffered as well. |
74 | +------------------------------------------------------------ |
75 | +revno: 120 |
76 | +committer: Henrik Rydberg <rydberg@bitmath.org> |
77 | +branch nick: trunk |
78 | +timestamp: Thu 2011-02-24 23:50:14 +0100 |
79 | +message: |
80 | + Skip events selectively |
81 | + |
82 | + Buffer all events as planned, but strip the stream of all events |
83 | + involved with pointer and MT, rather than bluntly removing all |
84 | + events. In practise, this means button and switch events are let |
85 | + through, undistorted although possibly slightly delayed. |
86 | +------------------------------------------------------------ |
87 | +revno: 119 |
88 | +committer: Henrik Rydberg <rydberg@bitmath.org> |
89 | +branch nick: trunk |
90 | +timestamp: Thu 2011-02-24 23:49:59 +0100 |
91 | +message: |
92 | + Wait for the right number of fingers before gesture timeout |
93 | + |
94 | + A client listening only for multi-finger gestures will not get |
95 | + the chance to recognize unless there is a gesture timeout. This |
96 | + patch waits until the drag hold time has passed before releasing |
97 | + the touch. |
98 | +------------------------------------------------------------ |
99 | +revno: 118 |
100 | +committer: Henrik Rydberg <rydberg@bitmath.org> |
101 | +branch nick: trunk |
102 | +timestamp: Thu 2011-02-24 23:49:45 +0100 |
103 | +message: |
104 | + Introduce activation hold time |
105 | + |
106 | + Do not activate a drag, pinch or rotate immediately, even |
107 | + if the activation threshold is met. This allows for a smoother |
108 | + transition between fingers. |
109 | +------------------------------------------------------------ |
110 | +revno: 117 |
111 | +committer: Henrik Rydberg <rydberg@bitmath.org> |
112 | +branch nick: trunk |
113 | +timestamp: Thu 2011-02-24 23:49:22 +0100 |
114 | +message: |
115 | + Introduce gesture timeouts |
116 | + |
117 | + The timeout of a gesture is integral to the gesture type. |
118 | + This patch introduces timeout per gesture type, potentially |
119 | + enabling more control over gesture timing aspects. The timeout |
120 | + logic replaces the recently added recognition state. |
121 | +------------------------------------------------------------ |
122 | +revno: 116 |
123 | +committer: Henrik Rydberg <rydberg@bitmath.org> |
124 | +branch nick: trunk |
125 | +timestamp: Thu 2011-02-24 23:49:02 +0100 |
126 | +message: |
127 | + Revert "Add global vs local gesture handling" |
128 | +------------------------------------------------------------ |
129 | +revno: 115 |
130 | +committer: Henrik Rydberg <rydberg@bitmath.org> |
131 | +branch nick: trunk |
132 | +timestamp: Thu 2011-02-24 23:48:45 +0100 |
133 | +message: |
134 | + Revert "Add button passthrough" |
135 | +------------------------------------------------------------ |
136 | revno: 114 |
137 | +tags: v1.0.19 |
138 | committer: Chase Douglas <chase.douglas@ubuntu.com> |
139 | branch nick: utouch-grail |
140 | timestamp: Mon 2011-02-21 14:20:28 -0500 |
141 | |
142 | === modified file 'config-aux/ltmain.sh' |
143 | --- config-aux/ltmain.sh 2011-02-21 19:59:12 +0000 |
144 | +++ config-aux/ltmain.sh 2011-03-09 15:59:59 +0000 |
145 | @@ -65,7 +65,7 @@ |
146 | # compiler: $LTCC |
147 | # compiler flags: $LTCFLAGS |
148 | # linker: $LD (gnu? $with_gnu_ld) |
149 | -# $progname: (GNU libtool) 2.2.6b Debian-2.2.6b-2ubuntu2 |
150 | +# $progname: (GNU libtool) 2.2.6b Debian-2.2.6b-2ubuntu3 |
151 | # automake: $automake_version |
152 | # autoconf: $autoconf_version |
153 | # |
154 | @@ -73,7 +73,7 @@ |
155 | |
156 | PROGRAM=ltmain.sh |
157 | PACKAGE=libtool |
158 | -VERSION="2.2.6b Debian-2.2.6b-2ubuntu2" |
159 | +VERSION="2.2.6b Debian-2.2.6b-2ubuntu3" |
160 | TIMESTAMP="" |
161 | package_revision=1.3017 |
162 | |
163 | |
164 | === modified file 'configure' |
165 | --- configure 2011-02-21 19:59:12 +0000 |
166 | +++ configure 2011-03-09 15:59:59 +0000 |
167 | @@ -1,6 +1,6 @@ |
168 | #! /bin/sh |
169 | # Guess values for system-dependent variables and create Makefiles. |
170 | -# Generated by GNU Autoconf 2.67 for Gesture Recognition And Instantiation Library 1.0.19. |
171 | +# Generated by GNU Autoconf 2.67 for Gesture Recognition And Instantiation Library 1.0.20. |
172 | # |
173 | # |
174 | # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, |
175 | @@ -698,8 +698,8 @@ |
176 | # Identity of this package. |
177 | PACKAGE_NAME='Gesture Recognition And Instantiation Library' |
178 | PACKAGE_TARNAME='utouch-grail' |
179 | -PACKAGE_VERSION='1.0.19' |
180 | -PACKAGE_STRING='Gesture Recognition And Instantiation Library 1.0.19' |
181 | +PACKAGE_VERSION='1.0.20' |
182 | +PACKAGE_STRING='Gesture Recognition And Instantiation Library 1.0.20' |
183 | PACKAGE_BUGREPORT='' |
184 | PACKAGE_URL='' |
185 | |
186 | @@ -1434,7 +1434,7 @@ |
187 | # Omit some internal or obsolete options to make the list less imposing. |
188 | # This message is too long to be a string in the A/UX 3.1 sh. |
189 | cat <<_ACEOF |
190 | -\`configure' configures Gesture Recognition And Instantiation Library 1.0.19 to adapt to many kinds of systems. |
191 | +\`configure' configures Gesture Recognition And Instantiation Library 1.0.20 to adapt to many kinds of systems. |
192 | |
193 | Usage: $0 [OPTION]... [VAR=VALUE]... |
194 | |
195 | @@ -1504,7 +1504,7 @@ |
196 | |
197 | if test -n "$ac_init_help"; then |
198 | case $ac_init_help in |
199 | - short | recursive ) echo "Configuration of Gesture Recognition And Instantiation Library 1.0.19:";; |
200 | + short | recursive ) echo "Configuration of Gesture Recognition And Instantiation Library 1.0.20:";; |
201 | esac |
202 | cat <<\_ACEOF |
203 | |
204 | @@ -1619,7 +1619,7 @@ |
205 | test -n "$ac_init_help" && exit $ac_status |
206 | if $ac_init_version; then |
207 | cat <<\_ACEOF |
208 | -Gesture Recognition And Instantiation Library configure 1.0.19 |
209 | +Gesture Recognition And Instantiation Library configure 1.0.20 |
210 | generated by GNU Autoconf 2.67 |
211 | |
212 | Copyright (C) 2010 Free Software Foundation, Inc. |
213 | @@ -1897,7 +1897,7 @@ |
214 | This file contains any messages produced by compilers while |
215 | running configure, to aid debugging if configure makes a mistake. |
216 | |
217 | -It was created by Gesture Recognition And Instantiation Library $as_me 1.0.19, which was |
218 | +It was created by Gesture Recognition And Instantiation Library $as_me 1.0.20, which was |
219 | generated by GNU Autoconf 2.67. Invocation command line was |
220 | |
221 | $ $0 $@ |
222 | @@ -2717,7 +2717,7 @@ |
223 | |
224 | # Define the identity of the package. |
225 | PACKAGE='utouch-grail' |
226 | - VERSION='1.0.19' |
227 | + VERSION='1.0.20' |
228 | |
229 | |
230 | cat >>confdefs.h <<_ACEOF |
231 | @@ -11977,7 +11977,7 @@ |
232 | # report actual input values of CONFIG_FILES etc. instead of their |
233 | # values after options handling. |
234 | ac_log=" |
235 | -This file was extended by Gesture Recognition And Instantiation Library $as_me 1.0.19, which was |
236 | +This file was extended by Gesture Recognition And Instantiation Library $as_me 1.0.20, which was |
237 | generated by GNU Autoconf 2.67. Invocation command line was |
238 | |
239 | CONFIG_FILES = $CONFIG_FILES |
240 | @@ -12043,7 +12043,7 @@ |
241 | cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 |
242 | ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" |
243 | ac_cs_version="\\ |
244 | -Gesture Recognition And Instantiation Library config.status 1.0.19 |
245 | +Gesture Recognition And Instantiation Library config.status 1.0.20 |
246 | configured by $0, generated by GNU Autoconf 2.67, |
247 | with options \\"\$ac_cs_config\\" |
248 | |
249 | |
250 | === modified file 'configure.ac' |
251 | --- configure.ac 2011-02-21 19:59:12 +0000 |
252 | +++ configure.ac 2011-03-09 15:59:59 +0000 |
253 | @@ -1,7 +1,7 @@ |
254 | # Initialize Autoconf |
255 | AC_PREREQ([2.60]) |
256 | AC_INIT([Gesture Recognition And Instantiation Library], |
257 | - [1.0.19], |
258 | + [1.0.20], |
259 | [], |
260 | [utouch-grail]) |
261 | AC_CONFIG_SRCDIR([Makefile.am]) |
262 | |
263 | === modified file 'debian/changelog' |
264 | --- debian/changelog 2011-02-22 20:18:14 +0000 |
265 | +++ debian/changelog 2011-03-09 15:59:59 +0000 |
266 | @@ -1,3 +1,10 @@ |
267 | +utouch-grail (1.0.20-0ubuntu1) UNRELEASED; urgency=low |
268 | + |
269 | + * New upstream release. |
270 | + * Fixes bug LP: #637106 |
271 | + |
272 | + -- Henrik Rydberg <rydberg@bitmath.org> Wed, 09 Mar 2011 16:54:31 +0100 |
273 | + |
274 | utouch-grail (1.0.19-0ubuntu2) natty; urgency=low |
275 | |
276 | * Rebuild against utouch-frame 1.0.0-0ubuntu3 to fix udeb dependencies. |
277 | |
278 | === removed directory 'debian/patches' |
279 | === removed file 'debian/patches/series' |
280 | === modified file 'src/evbuf.h' |
281 | --- src/evbuf.h 2010-08-10 16:50:41 +0000 |
282 | +++ src/evbuf.h 2011-03-09 15:59:59 +0000 |
283 | @@ -29,7 +29,7 @@ |
284 | #ifndef GRAIL_EVBUF_H |
285 | #define GRAIL_EVBUF_H |
286 | |
287 | -#define DIM_EVENTS 512 |
288 | +#define DIM_EVENTS 4096 |
289 | |
290 | struct evbuf { |
291 | int head; |
292 | |
293 | === modified file 'src/gestures-drag.c' |
294 | --- src/gestures-drag.c 2011-01-02 12:08:08 +0000 |
295 | +++ src/gestures-drag.c 2011-03-09 15:59:59 +0000 |
296 | @@ -72,6 +72,13 @@ |
297 | state->active = 0; |
298 | } |
299 | } |
300 | + if ((move->timeout & fm_mask) == fm_mask) { |
301 | + if (state->active) { |
302 | + gin_gid_discard(ge, state->gid); |
303 | + state->active = 0; |
304 | + } |
305 | + return 0; |
306 | + } |
307 | if (!state->active) { |
308 | int type = getype[move->ntouch]; |
309 | if (type < 0) |
310 | @@ -102,6 +109,13 @@ |
311 | state->active = 0; |
312 | } |
313 | } |
314 | + if ((move->timeout & fm_mask) == fm_mask) { |
315 | + if (state->active) { |
316 | + gin_gid_discard(ge, state->gid); |
317 | + state->active = 0; |
318 | + } |
319 | + return 0; |
320 | + } |
321 | if (!state->active) { |
322 | if (move->ntouch == 4) { |
323 | state->gid = gin_gid_begin(ge, GRAIL_TYPE_MDRAG, |
324 | |
325 | === modified file 'src/gestures-pinch.c' |
326 | --- src/gestures-pinch.c 2011-01-03 16:00:56 +0000 |
327 | +++ src/gestures-pinch.c 2011-03-09 15:59:59 +0000 |
328 | @@ -54,7 +54,7 @@ |
329 | struct combo_model *state = &gru->pinch; |
330 | struct move_model *move = &gru->move; |
331 | int mask = state->active ? (move->active & fm_mask) : fm_mask; |
332 | - if (!move->multi) { |
333 | + if (!move->multi && !move->single) { |
334 | if (state->active) { |
335 | gru_end(ge, state->gid, move, |
336 | state->prop, state->nprop); |
337 | @@ -62,6 +62,13 @@ |
338 | } |
339 | return 0; |
340 | } |
341 | + if ((move->timeout & fm_mask) == fm_mask) { |
342 | + if (state->active) { |
343 | + gin_gid_discard(ge, state->gid); |
344 | + state->active = 0; |
345 | + } |
346 | + return 0; |
347 | + } |
348 | if (!(move->tickle & mask)) |
349 | return 0; |
350 | if (!state->active) { |
351 | @@ -93,6 +100,13 @@ |
352 | } |
353 | return 0; |
354 | } |
355 | + if ((move->timeout & fm_mask) == fm_mask) { |
356 | + if (state->active) { |
357 | + gin_gid_discard(ge, state->gid); |
358 | + state->active = 0; |
359 | + } |
360 | + return 0; |
361 | + } |
362 | if (!(move->tickle & mask)) |
363 | return 0; |
364 | if (!state->active) { |
365 | |
366 | === modified file 'src/gestures-rotate.c' |
367 | --- src/gestures-rotate.c 2011-01-03 16:00:56 +0000 |
368 | +++ src/gestures-rotate.c 2011-03-09 15:59:59 +0000 |
369 | @@ -53,7 +53,7 @@ |
370 | struct combo_model *state = &gru->rotate; |
371 | struct move_model *move = &gru->move; |
372 | int mask = state->active ? (move->active & fm_mask) : fm_mask; |
373 | - if (!move->multi) { |
374 | + if (!move->multi && !move->single) { |
375 | if (state->active) { |
376 | gru_end(ge, state->gid, move, |
377 | state->prop, state->nprop); |
378 | @@ -61,6 +61,13 @@ |
379 | } |
380 | return 0; |
381 | } |
382 | + if ((move->timeout & fm_mask) == fm_mask) { |
383 | + if (state->active) { |
384 | + gin_gid_discard(ge, state->gid); |
385 | + state->active = 0; |
386 | + } |
387 | + return 0; |
388 | + } |
389 | if (!(move->tickle & mask)) |
390 | return 0; |
391 | if (!state->active) { |
392 | @@ -92,6 +99,13 @@ |
393 | } |
394 | return 0; |
395 | } |
396 | + if ((move->timeout & fm_mask) == fm_mask) { |
397 | + if (state->active) { |
398 | + gin_gid_discard(ge, state->gid); |
399 | + state->active = 0; |
400 | + } |
401 | + return 0; |
402 | + } |
403 | if (!(move->tickle & mask)) |
404 | return 0; |
405 | if (!state->active) { |
406 | |
407 | === modified file 'src/gestures-tapping.c' |
408 | --- src/gestures-tapping.c 2011-02-21 19:59:12 +0000 |
409 | +++ src/gestures-tapping.c 2011-03-09 15:59:59 +0000 |
410 | @@ -43,8 +43,10 @@ |
411 | struct tapping_model *state = &gru->tapping; |
412 | struct move_model *move = &gru->move; |
413 | state->tap = 0; |
414 | - if (move->ntouch && move->ntouch < state->mintouch) |
415 | - state->end = move->time; |
416 | + if (frame->num_active && !frame->prev->num_active) { |
417 | + state->mintouch = 0; |
418 | + state->maxtouch = 0; |
419 | + } |
420 | if (move->ntouch > state->maxtouch) { |
421 | if (state->active) { |
422 | gin_gid_discard(ge, state->gid); |
423 | @@ -91,6 +93,8 @@ |
424 | if ((move->active & fm_mask) || |
425 | move->time - state->start > move->fm[FM_X].bar_ms) { |
426 | gin_gid_discard(ge, state->gid); |
427 | + state->mintouch = move->ntouch; |
428 | + state->maxtouch = move->ntouch; |
429 | state->active = 0; |
430 | } |
431 | return 0; |
432 | |
433 | === modified file 'src/grail-api.c' |
434 | --- src/grail-api.c 2011-02-21 19:59:12 +0000 |
435 | +++ src/grail-api.c 2011-03-09 15:59:59 +0000 |
436 | @@ -34,11 +34,6 @@ |
437 | #define DIM_FRAMES 100 |
438 | #define FRAME_RATE 100 |
439 | |
440 | -/* Wait time (ms) for number of touches to stabilize. */ |
441 | -static const unsigned int stable_time = 50; |
442 | -/* Maximum time (ms) for gesture to be recognized. */ |
443 | -static const unsigned int recognition_time = 300; |
444 | - |
445 | void grail_filter_abs_events(struct grail *ge, int usage) |
446 | { |
447 | struct grail_impl *x = ge->impl; |
448 | @@ -132,62 +127,72 @@ |
449 | max->y = s->max_y; |
450 | } |
451 | |
452 | -/* Check for any potential gestures given the number of touch points and where |
453 | - * they occur on screen. */ |
454 | -static int check_potential_gestures(struct grail *ge, |
455 | - const struct utouch_frame *frame) |
456 | -{ |
457 | - grail_mask_t types[DIM_GRAIL_TYPE_BYTES] = {0}; |
458 | - struct grail_client_info client; |
459 | - struct grail_coord pos[frame->num_active]; |
460 | - int i; |
461 | - |
462 | - switch (frame->num_active) { |
463 | - case 1: |
464 | - grail_mask_set(types, GRAIL_TYPE_DRAG1); |
465 | - grail_mask_set(types, GRAIL_TYPE_PINCH1); |
466 | - grail_mask_set(types, GRAIL_TYPE_ROTATE1); |
467 | - grail_mask_set(types, GRAIL_TYPE_TAP1); |
468 | - break; |
469 | - case 2: |
470 | - grail_mask_set(types, GRAIL_TYPE_DRAG2); |
471 | - grail_mask_set(types, GRAIL_TYPE_PINCH2); |
472 | - grail_mask_set(types, GRAIL_TYPE_ROTATE2); |
473 | - grail_mask_set(types, GRAIL_TYPE_TAP2); |
474 | - break; |
475 | - case 3: |
476 | - grail_mask_set(types, GRAIL_TYPE_DRAG3); |
477 | - grail_mask_set(types, GRAIL_TYPE_PINCH3); |
478 | - grail_mask_set(types, GRAIL_TYPE_ROTATE3); |
479 | - grail_mask_set(types, GRAIL_TYPE_TAP3); |
480 | - grail_mask_set(types, GRAIL_TYPE_EDRAG); |
481 | - grail_mask_set(types, GRAIL_TYPE_EPINCH); |
482 | - grail_mask_set(types, GRAIL_TYPE_EROTATE); |
483 | - break; |
484 | - case 4: |
485 | - grail_mask_set(types, GRAIL_TYPE_DRAG4); |
486 | - grail_mask_set(types, GRAIL_TYPE_PINCH4); |
487 | - grail_mask_set(types, GRAIL_TYPE_ROTATE4); |
488 | - grail_mask_set(types, GRAIL_TYPE_TAP4); |
489 | - grail_mask_set(types, GRAIL_TYPE_MDRAG); |
490 | - grail_mask_set(types, GRAIL_TYPE_MPINCH); |
491 | - grail_mask_set(types, GRAIL_TYPE_MROTATE); |
492 | - break; |
493 | - case 5: |
494 | - grail_mask_set(types, GRAIL_TYPE_DRAG5); |
495 | - grail_mask_set(types, GRAIL_TYPE_PINCH5); |
496 | - grail_mask_set(types, GRAIL_TYPE_ROTATE5); |
497 | - grail_mask_set(types, GRAIL_TYPE_TAP5); |
498 | - break; |
499 | - } |
500 | - |
501 | - for (i = 0; i < frame->num_active; i++) { |
502 | - pos[i].x = gin_prop_x(ge->gin, frame->active[i]->x); |
503 | - pos[i].y = gin_prop_y(ge->gin, frame->active[i]->y); |
504 | - } |
505 | - |
506 | - return ge->get_clients(ge, &client, 1, pos, frame->num_active, |
507 | - types, DIM_GRAIL_TYPE_BYTES); |
508 | +static void flush_events(struct grail *ge) |
509 | +{ |
510 | + struct grail_impl *impl = ge->impl; |
511 | + struct input_event iev; |
512 | + |
513 | + grailbuf_clear(&impl->gbuf); |
514 | + while (!evbuf_empty(&impl->evbuf)) { |
515 | + evbuf_get(&impl->evbuf, &iev); |
516 | + if (ge->event) |
517 | + ge->event(ge, &iev); |
518 | + } |
519 | +} |
520 | + |
521 | +static int skip_event(const struct input_event *ev, int count) |
522 | +{ |
523 | + switch (ev->type) { |
524 | + case EV_ABS: |
525 | + return 1; |
526 | + case EV_KEY: |
527 | + return ev->code >= BTN_DIGI && ev->code < BTN_WHEEL; |
528 | + case EV_SYN: |
529 | + switch (ev->code) { |
530 | + case SYN_MT_REPORT: |
531 | + return 1; |
532 | + case SYN_REPORT: |
533 | + return count == 0; |
534 | + default: |
535 | + return 0; |
536 | + } |
537 | + default: |
538 | + return 0; |
539 | + } |
540 | +} |
541 | + |
542 | +static void flush_gestures(struct grail *ge) |
543 | +{ |
544 | + struct grail_impl *impl = ge->impl; |
545 | + struct input_event iev; |
546 | + struct grail_event gev; |
547 | + int count = 0; |
548 | + |
549 | + while (!evbuf_empty(&impl->evbuf)) { |
550 | + evbuf_get(&impl->evbuf, &iev); |
551 | + if (skip_event(&iev, count)) |
552 | + continue; |
553 | + if (ge->event) |
554 | + ge->event(ge, &iev); |
555 | + if (iev.type == EV_SYN && iev.code == SYN_REPORT) |
556 | + count = 0; |
557 | + else |
558 | + count++; |
559 | + } |
560 | + while (!grailbuf_empty(&impl->gbuf)) { |
561 | + grailbuf_get(&impl->gbuf, &gev); |
562 | + if (ge->gesture) |
563 | + ge->gesture(ge, &gev); |
564 | + } |
565 | +} |
566 | + |
567 | +static int gesture_timeout(struct grail *ge, const struct utouch_frame *frame) |
568 | +{ |
569 | + struct gesture_recognizer *gru = ge->gru; |
570 | + struct gesture_inserter *gin = ge->gin; |
571 | + |
572 | + return grail_mask_count(gin->used, sizeof(gin->used)) == 0 && |
573 | + frame->time - frame->mod_time > gru->move.fm[FM_X].hold_ms; |
574 | } |
575 | |
576 | static void report_frame(struct grail *ge, |
577 | @@ -195,96 +200,27 @@ |
578 | const struct input_event *syn) |
579 | { |
580 | struct grail_impl *impl = ge->impl; |
581 | - struct gesture_recognizer *gru = ge->gru; |
582 | - struct input_event iev; |
583 | struct grail_event gev; |
584 | |
585 | ge->impl->frame = frame; |
586 | |
587 | - /* Reset timer when number of touches changes. */ |
588 | - if (frame->prev->revision != frame->revision && frame->num_active) { |
589 | - gru->start_time = frame->time; |
590 | - } |
591 | - |
592 | - /* Once touches have stabilized, check if there are any potential |
593 | - * gestures registered for the number of touches. */ |
594 | - if (gru->state == RECOGNIZING && |
595 | - frame->time > gru->start_time + stable_time && |
596 | - check_potential_gestures(ge, frame) == 0) |
597 | - gru->state = UNRECOGNIZED; |
598 | - |
599 | - /* Process the frame for gestures unless we're sure there are none. */ |
600 | - if (gru->state != UNRECOGNIZED) { |
601 | - gin_frame_begin(ge, frame); |
602 | - gru_recognize(ge, frame); |
603 | - gin_frame_end(ge, frame); |
604 | - } |
605 | - |
606 | - if (gru->state == RECOGNIZING) { |
607 | - /* If a gesture is recognized and either all touches lifted or |
608 | - * we are within the recognition interval, set state to |
609 | - * recognized. Note that taps do not stay in the used array, so |
610 | - * we must check if any gesture events are buffered. */ |
611 | - if ((grail_mask_count(ge->gin->used, DIM_INSTANCE_BYTES) || |
612 | - !grailbuf_empty(&impl->gbuf)) && |
613 | - (frame->num_active == 0 || |
614 | - (frame->time > gru->start_time + stable_time && |
615 | - frame->time <= gru->start_time + recognition_time))) { |
616 | - if (gru->global_client) |
617 | - gru->state = GLOBAL; |
618 | - else |
619 | - gru->state = LOCAL; |
620 | - } |
621 | - /* If there is no gesture and all touches lifted, set state to |
622 | - * unrecognized. */ |
623 | - else if (frame->num_active == 0) |
624 | - gru->state = UNRECOGNIZED; |
625 | - } |
626 | - |
627 | - /* Now we have the state set, process events. */ |
628 | - switch (gru->state) { |
629 | - case LOCAL: |
630 | - case GLOBAL: |
631 | - while (!grailbuf_empty(&impl->gbuf)) { |
632 | - grailbuf_get(&impl->gbuf, &gev); |
633 | - if (ge->gesture && |
634 | - ((gru->state == GLOBAL && |
635 | - gev.client_id.client == gru->global_client) || |
636 | - (gru->state == LOCAL && |
637 | - gev.client_id.client != gru->global_client))) |
638 | - ge->gesture(ge, &gev); |
639 | - } |
640 | - evbuf_clear(&impl->evbuf); |
641 | - |
642 | - /* Once all touches are lifted and no gestures are |
643 | - * active, reset recognition state. */ |
644 | - if (grail_mask_count(ge->gin->used, DIM_INSTANCE_BYTES) == 0 && |
645 | - frame->num_active == 0) { |
646 | - gru->state = RECOGNIZING; |
647 | - gru->global_client = 0; |
648 | - } |
649 | - break; |
650 | - |
651 | - case RECOGNIZING: |
652 | - /* If we're still actively recognizing, stop here. */ |
653 | - if (frame->time <= gru->start_time + recognition_time) |
654 | - break; |
655 | - gru->state = UNRECOGNIZED; |
656 | - |
657 | - case UNRECOGNIZED: |
658 | - while (!evbuf_empty(&impl->evbuf)) { |
659 | - evbuf_get(&impl->evbuf, &iev); |
660 | - if (ge->event) |
661 | - ge->event(ge, &iev); |
662 | - } |
663 | - grailbuf_clear(&impl->gbuf); |
664 | - |
665 | - if (frame->num_active == 0) { |
666 | - gru->state = RECOGNIZING; |
667 | - gru->global_client = 0; |
668 | - } |
669 | - break; |
670 | - } |
671 | + if (frame->num_active && !frame->prev->num_active) { |
672 | + impl->ongoing = 1; |
673 | + impl->gesture = 0; |
674 | + } |
675 | + |
676 | + if (!impl->ongoing) |
677 | + return; |
678 | + |
679 | + gin_frame_begin(ge, frame); |
680 | + gru_recognize(ge, frame); |
681 | + gin_frame_end(ge, frame); |
682 | + |
683 | + if (!grailbuf_empty(&impl->gbuf)) |
684 | + impl->gesture = 1; |
685 | + |
686 | + if (frame->num_active == 0 || gesture_timeout(ge, frame)) |
687 | + impl->ongoing &= impl->gesture; |
688 | } |
689 | |
690 | static void grail_pump_mtdev(struct grail *ge, const struct input_event *ev) |
691 | @@ -292,21 +228,6 @@ |
692 | struct grail_impl *impl = ge->impl; |
693 | const struct utouch_frame *frame; |
694 | |
695 | - if (ev->type == EV_KEY && (ev->code < BTN_DIGI || |
696 | - ev->code > BTN_TOOL_QUADTAP)) { |
697 | - struct input_event sync_ev; |
698 | - |
699 | - ge->event(ge, ev); |
700 | - |
701 | - sync_ev.type = EV_SYN; |
702 | - sync_ev.code = SYN_REPORT; |
703 | - sync_ev.value = 1; |
704 | - sync_ev.time = ev->time; |
705 | - ge->event(ge, &sync_ev); |
706 | - |
707 | - return; |
708 | - } |
709 | - |
710 | evbuf_put(&impl->evbuf, ev); |
711 | |
712 | if (ev->type == EV_SYN || ev->type == EV_ABS) { |
713 | @@ -314,6 +235,13 @@ |
714 | if (frame) |
715 | report_frame(ge, frame, ev); |
716 | } |
717 | + |
718 | + if (ev->type == EV_SYN) { |
719 | + if (!impl->ongoing) |
720 | + flush_events(ge); |
721 | + if (impl->gesture) |
722 | + flush_gestures(ge); |
723 | + } |
724 | } |
725 | |
726 | int grail_pull(struct grail *ge, int fd) |
727 | |
728 | === modified file 'src/grail-event.c' |
729 | --- src/grail-event.c 2011-02-09 15:12:13 +0000 |
730 | +++ src/grail-event.c 2011-03-09 15:59:59 +0000 |
731 | @@ -22,7 +22,6 @@ |
732 | |
733 | #include "grail-inserter.h" |
734 | #include "grail-impl.h" |
735 | -#include "grail-recognizer.h" |
736 | #include <malloc.h> |
737 | #include <string.h> |
738 | #include <errno.h> |
739 | @@ -83,7 +82,7 @@ |
740 | const struct utouch_frame *frame) |
741 | { |
742 | struct grail_coord pos[DIM_TOUCH]; |
743 | - int i, npos = 0, num_clients; |
744 | + int i, npos = 0; |
745 | if (!ge->get_clients) |
746 | return 0; |
747 | grail_mask_foreach(i, span, bspan) { |
748 | @@ -91,20 +90,7 @@ |
749 | pos[npos].y = gin_prop_y(ge->gin, frame->slots[i]->y); |
750 | npos++; |
751 | } |
752 | - |
753 | - num_clients = ge->get_clients(ge, info, maxinfo, pos, npos, types, |
754 | - btypes); |
755 | - |
756 | - /* Check if client is handling global gestures, using SYSFLAG1. */ |
757 | - if (num_clients > 0 && grail_mask_get(info[0].mask, |
758 | - GRAIL_TYPE_SYSFLAG1)) { |
759 | - /* Save client id, and clear SYSFLAG1 as it isn't a real |
760 | - * gesture type. */ |
761 | - ge->gru->global_client = info[0].id.client; |
762 | - grail_mask_clear(info[0].mask, GRAIL_TYPE_SYSFLAG1); |
763 | - } |
764 | - |
765 | - return num_clients; |
766 | + return ge->get_clients(ge, info, maxinfo, pos, npos, types, btypes); |
767 | } |
768 | |
769 | void gin_send_event(struct grail *ge, struct slot_state *s, |
770 | |
771 | === modified file 'src/grail-gestures.c' |
772 | --- src/grail-gestures.c 2011-01-03 16:00:56 +0000 |
773 | +++ src/grail-gestures.c 2011-03-09 15:59:59 +0000 |
774 | @@ -24,9 +24,10 @@ |
775 | #include "grail-impl.h" |
776 | #include <math.h> |
777 | |
778 | -static const float FM_SN[DIM_FM] = { 1000, 1000, 200, 1000 }; |
779 | -static const float FM_BAR[DIM_FM] = { 50, 50, 30, 50 }; |
780 | -static const grail_time_t FM_BAR_MS[DIM_FM] = { 300, 300, 10000, 10000 }; |
781 | +static const float FM_SN[DIM_FM] = { 1000, 1000, 1000, 1000 }; |
782 | +static const float FM_BAR[DIM_FM] = { 50, 50, 50, 50 }; |
783 | +static const grail_time_t FM_HOLD_MS[DIM_FM] = { 60, 60, 60, 60 }; |
784 | +static const grail_time_t FM_BAR_MS[DIM_FM] = { 300, 300, 500, 500 }; |
785 | static const grail_time_t SAMPLE_MS = 10; |
786 | static const float EPS = 1e-3; |
787 | |
788 | @@ -111,6 +112,7 @@ |
789 | fm->sample_ms = t; |
790 | m->tickle &= ~(1 << i); |
791 | m->active &= ~(1 << i); |
792 | + m->timeout &= ~(1 << i); |
793 | } |
794 | |
795 | static void move_update(struct move_model *m, int i, float x, grail_time_t t) |
796 | @@ -132,11 +134,15 @@ |
797 | if (m->active & (1 << i)) |
798 | return; |
799 | fm->action_delta = x - fm->original; |
800 | - if (fabs(fm->action_delta) > fm->bar || |
801 | - t - fm->original_ms > fm->bar_ms) |
802 | - m->active |= (1 << i); |
803 | - else |
804 | + if (t - fm->original_ms > fm->hold_ms && |
805 | + fabs(fm->action_delta) > fm->bar) { |
806 | + m->active |= (1 << i); |
807 | + } else if (t - fm->original_ms > fm->bar_ms) { |
808 | + m->active |= (1 << i); |
809 | + m->timeout |= (1 << i); |
810 | + } else { |
811 | fm->action_delta = 0; |
812 | + } |
813 | } |
814 | |
815 | void gru_init_motion(struct grail *ge) |
816 | @@ -153,6 +159,7 @@ |
817 | for (i = 0; i < DIM_FM; i++) { |
818 | m->fm[i].fuzz = D[i] / FM_SN[i]; |
819 | m->fm[i].bar = D[i] / FM_BAR[i]; |
820 | + m->fm[i].hold_ms = FM_HOLD_MS[i]; |
821 | m->fm[i].bar_ms = FM_BAR_MS[i]; |
822 | } |
823 | } |
824 | |
825 | === modified file 'src/grail-gestures.h' |
826 | --- src/grail-gestures.h 2011-01-03 16:00:56 +0000 |
827 | +++ src/grail-gestures.h 2011-03-09 15:59:59 +0000 |
828 | @@ -49,12 +49,13 @@ |
829 | float bar; |
830 | grail_time_t original_ms; |
831 | grail_time_t sample_ms; |
832 | + grail_time_t hold_ms; |
833 | grail_time_t bar_ms; |
834 | }; |
835 | |
836 | struct move_model { |
837 | struct filter_model fm[DIM_FM]; |
838 | - int tickle, active; |
839 | + int tickle, active, timeout; |
840 | int single, multi, ntouch; |
841 | grail_time_t time; |
842 | }; |
843 | @@ -97,7 +98,7 @@ |
844 | const struct utouch_frame *frame); |
845 | |
846 | struct tapping_model { |
847 | - grail_time_t start, end; |
848 | + grail_time_t start; |
849 | int mintouch, maxtouch; |
850 | int active, gid, tap; |
851 | int nprop; |
852 | |
853 | === modified file 'src/grail-impl.h' |
854 | --- src/grail-impl.h 2011-02-02 22:16:20 +0000 |
855 | +++ src/grail-impl.h 2011-03-09 15:59:59 +0000 |
856 | @@ -42,6 +42,8 @@ |
857 | struct evbuf evbuf; |
858 | struct grailbuf gbuf; |
859 | int filter_abs; |
860 | + int ongoing; |
861 | + int gesture; |
862 | }; |
863 | |
864 | #endif |
865 | |
866 | === modified file 'src/grail-inserter.c' |
867 | --- src/grail-inserter.c 2011-01-03 16:00:56 +0000 |
868 | +++ src/grail-inserter.c 2011-03-09 15:59:59 +0000 |
869 | @@ -69,6 +69,13 @@ |
870 | for (j = 0; j < nclient; j++) { |
871 | if (!grail_mask_get(info[j].mask, s->type)) |
872 | continue; |
873 | + if (gin->grab_active && |
874 | + info[j].id.client != gin->grab_client) |
875 | + continue; |
876 | + if (grail_mask_get(info[j].mask, GRAIL_TYPE_SYSFLAG1)) { |
877 | + gin->grab_active = 1; |
878 | + gin->grab_client = info[j].id.client; |
879 | + } |
880 | s->client_id[s->nclient++] = info[j].id; |
881 | } |
882 | } |
883 | @@ -105,6 +112,8 @@ |
884 | struct gesture_inserter *gin = ge->gin; |
885 | memset(gin->types, 0, sizeof(gin->types)); |
886 | gin->time = frame->time; |
887 | + if (frame->num_active && !frame->prev->num_active) |
888 | + gin->grab_active = 0; |
889 | } |
890 | |
891 | void gin_frame_end(struct grail *ge, const struct utouch_frame *frame) |
892 | |
893 | === modified file 'src/grail-inserter.h' |
894 | --- src/grail-inserter.h 2011-01-03 16:00:56 +0000 |
895 | +++ src/grail-inserter.h 2011-03-09 15:59:59 +0000 |
896 | @@ -53,6 +53,8 @@ |
897 | grail_mask_t used[DIM_INSTANCE_BYTES]; |
898 | grail_time_t time; |
899 | int gestureid; |
900 | + int grab_active; |
901 | + int grab_client; |
902 | float scale_x, scale_y, scale_r; |
903 | float trans_x, trans_y; |
904 | }; |
905 | |
906 | === modified file 'src/grail-recognizer.h' |
907 | --- src/grail-recognizer.h 2011-02-21 19:59:12 +0000 |
908 | +++ src/grail-recognizer.h 2011-03-09 15:59:59 +0000 |
909 | @@ -25,13 +25,6 @@ |
910 | |
911 | #include "grail-gestures.h" |
912 | |
913 | -enum recognition_state { |
914 | - RECOGNIZING, |
915 | - LOCAL, |
916 | - GLOBAL, |
917 | - UNRECOGNIZED |
918 | -}; |
919 | - |
920 | struct gesture_recognizer { |
921 | struct move_model move; |
922 | struct combo_model drag; |
923 | @@ -41,9 +34,6 @@ |
924 | struct combo_model winpinch; |
925 | struct combo_model winrotate; |
926 | struct tapping_model tapping; |
927 | - utouch_frame_time_t start_time; |
928 | - enum recognition_state state; |
929 | - int global_client; |
930 | }; |
931 | |
932 | int gru_init(struct grail *ge); |
Looks good.