Merge lp:~bregma/geis/lp-742555 into lp:geis

Proposed by Stephen M. Webb
Status: Merged
Merged at revision: 129
Proposed branch: lp:~bregma/geis/lp-742555
Merge into: lp:geis
Diff against target: 499 lines (+229/-56)
9 files modified
ChangeLog (+21/-0)
include/geis/geis.h (+10/-0)
libutouch-geis/backend/xcb/geis_xcb_backend.c (+10/-7)
libutouch-geis/backend/xcb/grail_gestures.c (+102/-49)
libutouch-geis/geis_v1.c (+5/-0)
testsuite/geis1/Makefile.am (+1/-0)
testsuite/geis1/check_geis1_api.c (+2/-0)
testsuite/geis1/check_gesture_types.c (+77/-0)
testsuite/geistest/geistest.c (+1/-0)
To merge this branch: bzr merge lp:~bregma/geis/lp-742555
Reviewer Review Type Date Requested Status
Chase Douglas (community) Approve
Review via email: mp+54920@code.launchpad.net

Description of the change

Adds through support for TOUCH gesture types for direct touch begin/end handling.

To post a comment you must log in.
Revision history for this message
Chase Douglas (chasedouglas) wrote :

I'd prefer to move to C99 and use dynamic array sizes than use alloca, just cause it seems more conventional.

The s_grail_class_map array has a bunch of changes to unaffected gesture types. It appears there's a comma added near the end of each line. I think the comma is superfluous and should be removed so there's no change.

grail_mask_clear could just use memset, which would make the code more readable.

Why does grail_mask_setbit only concern itself with the lower 5 bits of each uint32_t?

Although grail exposes velocity attributes for touch gestures, I don't want to expose the attributes through GEIS. I propose masking them out.

Looks good otherwise!

review: Needs Fixing
lp:~bregma/geis/lp-742555 updated
130. By Stephen M. Webb

* Replaced alloca() calls with C99 dynamic arrays.
* Used memset instead of a for-loop for array initialization.
* Removed extraneous commas from s_grail_class_map.

131. By Stephen M. Webb

Properly initialized the grail gesture bitmask in all cases.

Revision history for this message
Stephen M. Webb (bregma) wrote :

New revision pushed up.

(1) alloca() replaced by C99 dynamic arrays.
(b) used memset() instead of a for-loop to initialize the array.
(3) removed extraneous commas.
(5) initialized all instances of mask_len.

grail_mask_setbit() only concerns itself with the lower 2^5 bits of each uint32_t because there are only 2^5 bits in a uint32_t.

lp:~bregma/geis/lp-742555 updated
132. By Stephen M. Webb

Cleared touch count mask.

133. By Stephen M. Webb

Changed the list of properties received from grail for the Touch gesture.

Revision history for this message
Chase Douglas (chasedouglas) wrote :

The code looks good now, and geistest is behaving as I expect :).

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ChangeLog'
--- ChangeLog 2011-03-24 19:38:36 +0000
+++ ChangeLog 2011-03-28 12:59:24 +0000
@@ -1,3 +1,24 @@
12011-03-28 Stephen M. Webb <stephen.webb@canonical.com>
2
3 Changes the list of attrs received from grail for the Touch gesture.
4
5 * libutouch-geis/backend/xcb/grail_gestures.c: change Touch attrs
6
72011-03-25 Stephen M. Webb <stephen.webb@canonical.com>
8
9 Added new TOUCH gesture types (LP: #742555).
10
11 * include/geis/geis.h: added new TOUCH gesture types
12 * libutouch-geis/backend/xcb/geis_xcb_backend.c: tweaked gesture mask size
13 * libutouch-geis/backend/xcb/grail_gestures.c: added new TOUCH gesture types
14 added proper handling of a variable-size gesture mask
15 * libutouch-geis/geis_v1.c: mapped new TOUCH gesture types to grail TOUCH
16 gesture types
17 * testsuite/geis1/check_gesture_types.c: new testsuite
18 * testsuite/geis1/Makefile.am: added new testsuite
19 * testsuite/geis1/check_geis1_api.c: invoked new testsuite
20 * testsuite/geistest/geistest.c: added new gesture types
21
12011-03-24 Stephen M. Webb <stephen.webb@canonical.com>222011-03-24 Stephen M. Webb <stephen.webb@canonical.com>
223
3 Fixed a bad index when translating grail touches (LP: #742002).24 Fixed a bad index when translating grail touches (LP: #742002).
425
=== modified file 'include/geis/geis.h'
--- include/geis/geis.h 2011-03-17 23:42:48 +0000
+++ include/geis/geis.h 2011-03-28 12:59:24 +0000
@@ -107,6 +107,7 @@
107#define GEIS_GESTURE_PINCH "Pinch"107#define GEIS_GESTURE_PINCH "Pinch"
108#define GEIS_GESTURE_ROTATE "Rotate"108#define GEIS_GESTURE_ROTATE "Rotate"
109#define GEIS_GESTURE_TAP "Tap"109#define GEIS_GESTURE_TAP "Tap"
110#define GEIS_GESTURE_TOUCH "Touch"
110111
111/**112/**
112 * @defgroup geis_v1_gesture_types Gesture Types113 * @defgroup geis_v1_gesture_types Gesture Types
@@ -143,11 +144,15 @@
143 *144 *
144 * @def GEIS_GESTURE_PRIMITIVE_TAP145 * @def GEIS_GESTURE_PRIMITIVE_TAP
145 * A tap. Touch down, touch up, one or more touches.146 * A tap. Touch down, touch up, one or more touches.
147 *
148 * @def GEIS_GESTURE_PRIMITIVE_TOUCH
149 * A parenthetical gesture event. Touch down (start) and up (finish).
146 */150 */
147#define GEIS_GESTURE_PRIMITIVE_DRAG 0151#define GEIS_GESTURE_PRIMITIVE_DRAG 0
148#define GEIS_GESTURE_PRIMITIVE_PINCH 1152#define GEIS_GESTURE_PRIMITIVE_PINCH 1
149#define GEIS_GESTURE_PRIMITIVE_ROTATE 2153#define GEIS_GESTURE_PRIMITIVE_ROTATE 2
150#define GEIS_GESTURE_PRIMITIVE_TAP 15 154#define GEIS_GESTURE_PRIMITIVE_TAP 15
155#define GEIS_GESTURE_PRIMITIVE_TOUCH 32
151156
152/* @} */157/* @} */
153158
@@ -182,6 +187,11 @@
182#define GEIS_GESTURE_TYPE_TAP3 "Tap,touch=3"187#define GEIS_GESTURE_TYPE_TAP3 "Tap,touch=3"
183#define GEIS_GESTURE_TYPE_TAP4 "Tap,touch=4"188#define GEIS_GESTURE_TYPE_TAP4 "Tap,touch=4"
184#define GEIS_GESTURE_TYPE_TAP5 "Tap,touch=5"189#define GEIS_GESTURE_TYPE_TAP5 "Tap,touch=5"
190#define GEIS_GESTURE_TYPE_TOUCH1 "Touch,touch=1"
191#define GEIS_GESTURE_TYPE_TOUCH2 "Touch,touch=2"
192#define GEIS_GESTURE_TYPE_TOUCH3 "Touch,touch=3"
193#define GEIS_GESTURE_TYPE_TOUCH4 "Touch,touch=4"
194#define GEIS_GESTURE_TYPE_TOUCH5 "Touch,touch=5"
185195
186/* @} */196/* @} */
187197
188198
=== modified file 'libutouch-geis/backend/xcb/geis_xcb_backend.c'
--- libutouch-geis/backend/xcb/geis_xcb_backend.c 2011-03-24 19:38:36 +0000
+++ libutouch-geis/backend/xcb/geis_xcb_backend.c 2011-03-28 12:59:24 +0000
@@ -47,6 +47,8 @@
47#define MAX_NUM_DEVICES 1047#define MAX_NUM_DEVICES 10
48#define MAX_NUM_WINDOWS 1048#define MAX_NUM_WINDOWS 10
4949
50#define GRAIL_XCB_BITMASK_LEN 2
51
5052
51static inline GeisSize53static inline GeisSize
52_min(GeisSize a, GeisSize b)54_min(GeisSize a, GeisSize b)
@@ -83,7 +85,7 @@
83 uint16_t devices[MAX_NUM_DEVICES]; 85 uint16_t devices[MAX_NUM_DEVICES];
84 uint16_t device_count;86 uint16_t device_count;
85 int num_class_filters;87 int num_class_filters;
86 uint32_t mask[1];88 uint32_t mask[GRAIL_XCB_BITMASK_LEN];
87 uint32_t mask_len;89 uint32_t mask_len;
88 int num_region_filters;90 int num_region_filters;
89 xcb_window_t windows[MAX_NUM_WINDOWS];91 xcb_window_t windows[MAX_NUM_WINDOWS];
@@ -537,8 +539,8 @@
537 GeisString class_name = NULL;539 GeisString class_name = NULL;
538 GeisSize min_touches = MIN_TOUCHES;540 GeisSize min_touches = MIN_TOUCHES;
539 GeisSize max_touches = MAX_TOUCHES;541 GeisSize max_touches = MAX_TOUCHES;
540 uint32_t mask_len;542 uint32_t mask_len = GRAIL_XCB_BITMASK_LEN;
541 uint32_t mask[1];543 uint32_t mask[mask_len];
542544
543 geis_xcb_backend_gesture_bitmask_init(geis_subscription_flags(sub),545 geis_xcb_backend_gesture_bitmask_init(geis_subscription_flags(sub),
544 &mask_len, mask);546 &mask_len, mask);
@@ -600,6 +602,7 @@
600 geis_error("error allocating xcb-gesture subscription");602 geis_error("error allocating xcb-gesture subscription");
601 goto error_exit;603 goto error_exit;
602 }604 }
605 xsub->mask_len = GRAIL_XCB_BITMASK_LEN;
603606
604 /* Translate the GEIS v2 subscription into an XCB subscription. */607 /* Translate the GEIS v2 subscription into an XCB subscription. */
605 for (i = 0; i < filter_count; ++i)608 for (i = 0; i < filter_count; ++i)
@@ -652,13 +655,13 @@
652 xcb_generic_error_t *error;655 xcb_generic_error_t *error;
653 xcb_void_cookie_t select_cookie;656 xcb_void_cookie_t select_cookie;
654657
655 geis_debug("window_id=0x%08x device_id=%d mask_len=%d mask[0]=0x%08x",658 geis_debug("window_id=0x%08x device_id=%d mask_len=%d mask=0x%08x %08x",
656 xsub->windows[win], xsub->devices[dev],659 xsub->windows[win], xsub->devices[dev],
657 xsub->mask_len, xsub->mask[0]);660 xsub->mask_len, xsub->mask[1], xsub->mask[0]);
658 select_cookie = xcb_gesture_select_events_checked(xcb->xcb_connection,661 select_cookie = xcb_gesture_select_events_checked(xcb->xcb_connection,
659 xsub->windows[win],662 xsub->windows[win],
660 xsub->devices[dev],663 (uint16_t)xsub->devices[dev],
661 xsub->mask_len,664 (uint16_t)xsub->mask_len,
662 xsub->mask);665 xsub->mask);
663 error = xcb_request_check(xcb->xcb_connection, select_cookie);666 error = xcb_request_check(xcb->xcb_connection, select_cookie);
664 if (error)667 if (error)
665668
=== modified file 'libutouch-geis/backend/xcb/grail_gestures.c'
--- libutouch-geis/backend/xcb/grail_gestures.c 2011-03-22 16:14:01 +0000
+++ libutouch-geis/backend/xcb/grail_gestures.c 2011-03-28 12:59:24 +0000
@@ -38,6 +38,14 @@
3838
39static GeisFloat zero = 0.0f;39static GeisFloat zero = 0.0f;
4040
41static struct _AttrInitializer s_touch_attrs[] = {
42 { GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_X1, GEIS_ATTR_TYPE_FLOAT, &zero },
43 { GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_Y1, GEIS_ATTR_TYPE_FLOAT, &zero },
44 { GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_X2, GEIS_ATTR_TYPE_FLOAT, &zero },
45 { GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_Y2, GEIS_ATTR_TYPE_FLOAT, &zero },
46 { NULL, 0, &zero }
47};
48
41static struct _AttrInitializer s_drag_attrs[] = {49static struct _AttrInitializer s_drag_attrs[] = {
42 { GEIS_GESTURE_ATTRIBUTE_DELTA_X, GEIS_ATTR_TYPE_FLOAT, &zero },50 { GEIS_GESTURE_ATTRIBUTE_DELTA_X, GEIS_ATTR_TYPE_FLOAT, &zero },
43 { GEIS_GESTURE_ATTRIBUTE_DELTA_Y, GEIS_ATTR_TYPE_FLOAT, &zero },51 { GEIS_GESTURE_ATTRIBUTE_DELTA_Y, GEIS_ATTR_TYPE_FLOAT, &zero },
@@ -128,19 +136,54 @@
128 { GRAIL_TYPE_TAP3, GEIS_GESTURE_PRIMITIVE_TAP, GEIS_GESTURE_TYPE_TAP3, GEIS_GESTURE_TAP, s_tap_attrs, 3 },136 { GRAIL_TYPE_TAP3, GEIS_GESTURE_PRIMITIVE_TAP, GEIS_GESTURE_TYPE_TAP3, GEIS_GESTURE_TAP, s_tap_attrs, 3 },
129 { GRAIL_TYPE_TAP4, GEIS_GESTURE_PRIMITIVE_TAP, GEIS_GESTURE_TYPE_TAP4, GEIS_GESTURE_TAP, s_tap_attrs, 4 },137 { GRAIL_TYPE_TAP4, GEIS_GESTURE_PRIMITIVE_TAP, GEIS_GESTURE_TYPE_TAP4, GEIS_GESTURE_TAP, s_tap_attrs, 4 },
130 { GRAIL_TYPE_TAP5, GEIS_GESTURE_PRIMITIVE_TAP, GEIS_GESTURE_TYPE_TAP5, GEIS_GESTURE_TAP, s_tap_attrs, 5 },138 { GRAIL_TYPE_TAP5, GEIS_GESTURE_PRIMITIVE_TAP, GEIS_GESTURE_TYPE_TAP5, GEIS_GESTURE_TAP, s_tap_attrs, 5 },
139 { GRAIL_TYPE_TOUCH1, GEIS_GESTURE_PRIMITIVE_TOUCH, GEIS_GESTURE_TYPE_TOUCH1, GEIS_GESTURE_TOUCH, s_touch_attrs, 1 },
140 { GRAIL_TYPE_TOUCH2, GEIS_GESTURE_PRIMITIVE_TOUCH, GEIS_GESTURE_TYPE_TOUCH2, GEIS_GESTURE_TOUCH, s_touch_attrs, 2 },
141 { GRAIL_TYPE_TOUCH3, GEIS_GESTURE_PRIMITIVE_TOUCH, GEIS_GESTURE_TYPE_TOUCH3, GEIS_GESTURE_TOUCH, s_touch_attrs, 3 },
142 { GRAIL_TYPE_ETOUCH, GEIS_GESTURE_PRIMITIVE_TOUCH, GEIS_GESTURE_TYPE_TOUCH3, GEIS_GESTURE_TOUCH, s_touch_attrs, 3 },
143 { GRAIL_TYPE_TOUCH4, GEIS_GESTURE_PRIMITIVE_TOUCH, GEIS_GESTURE_TYPE_TOUCH4, GEIS_GESTURE_TOUCH, s_touch_attrs, 4 },
144 { GRAIL_TYPE_MTOUCH, GEIS_GESTURE_PRIMITIVE_TOUCH, GEIS_GESTURE_TYPE_TOUCH4, GEIS_GESTURE_TOUCH, s_touch_attrs, 4 },
145 { GRAIL_TYPE_TOUCH5, GEIS_GESTURE_PRIMITIVE_TOUCH, GEIS_GESTURE_TYPE_TOUCH5, GEIS_GESTURE_TOUCH, s_touch_attrs, 5 },
131 { -1, -1, NULL, NULL, NULL, 0 } /* sentinel */146 { -1, -1, NULL, NULL, NULL, 0 } /* sentinel */
132};147};
133148
134149
135/*150/*
136 * Gets the bitmask for an entry in the GrailClassMap.151 * Clears all the bits in a bitmask.
137 */152 */
138static inline GeisInteger153static inline void
139_grail_bitmask_for(const GrailClassMap *entry)154_grail_mask_clear(uint32_t mask_len,
140{155 uint32_t* mask)
141 return 1 << entry->grail_type;156{
142}157 memset(mask, 0, mask_len * sizeof(uint32_t));
143158}
159
160/*
161 * Sets the indicated bit in the bitmask.
162 *
163 * @todo: convert form uint32_t masks to byte masks
164 */
165static inline void
166_grail_mask_set_bit(uint32_t mask_len __attribute__((unused)),
167 uint32_t* mask,
168 int index)
169{
170 mask[index >> 5] |= 1 << (index & 0x1f);
171}
172
173/*
174 * Masks the bits in one bitmask by the bots in another.
175 */
176static inline void
177_grail_mask_and(uint32_t mask_len,
178 uint32_t* mask_lhs,
179 uint32_t* mask_rhs)
180{
181 uint32_t i;
182 for (i = 0; i < mask_len; ++i)
183 {
184 mask_lhs[i] &= mask_rhs[i];
185 }
186}
144187
145/*188/*
146 * Initializes the XCB gesture bitmap flags.189 * Initializes the XCB gesture bitmap flags.
@@ -153,40 +196,46 @@
153 uint32_t *mask_len,196 uint32_t *mask_len,
154 uint32_t *mask)197 uint32_t *mask)
155{198{
156 *mask_len = 1; /* always */199 _grail_mask_clear(*mask_len, mask);
157 *mask = 0;200
158 *mask = (1 << GRAIL_TYPE_DRAG1)201 _grail_mask_set_bit(*mask_len, mask, GRAIL_TYPE_DRAG1);
159 | (1 << GRAIL_TYPE_PINCH1)202 _grail_mask_set_bit(*mask_len, mask, GRAIL_TYPE_PINCH1);
160 | (1 << GRAIL_TYPE_ROTATE1)203 _grail_mask_set_bit(*mask_len, mask, GRAIL_TYPE_ROTATE1);
161 | (1 << GRAIL_TYPE_TAP1)204 _grail_mask_set_bit(*mask_len, mask, GRAIL_TYPE_TAP1);
162 | (1 << GRAIL_TYPE_DRAG2)205 _grail_mask_set_bit(*mask_len, mask, GRAIL_TYPE_TOUCH1);
163 | (1 << GRAIL_TYPE_PINCH2)206 _grail_mask_set_bit(*mask_len, mask, GRAIL_TYPE_DRAG2);
164 | (1 << GRAIL_TYPE_ROTATE2)207 _grail_mask_set_bit(*mask_len, mask, GRAIL_TYPE_PINCH2);
165 | (1 << GRAIL_TYPE_TAP2)208 _grail_mask_set_bit(*mask_len, mask, GRAIL_TYPE_ROTATE2);
166 | (1 << GRAIL_TYPE_TAP3)209 _grail_mask_set_bit(*mask_len, mask, GRAIL_TYPE_TAP2);
167 | (1 << GRAIL_TYPE_TAP4)210 _grail_mask_set_bit(*mask_len, mask, GRAIL_TYPE_TOUCH2);
168 | (1 << GRAIL_TYPE_DRAG5)211 _grail_mask_set_bit(*mask_len, mask, GRAIL_TYPE_TAP3);
169 | (1 << GRAIL_TYPE_PINCH5)212 _grail_mask_set_bit(*mask_len, mask, GRAIL_TYPE_TAP4);
170 | (1 << GRAIL_TYPE_ROTATE5)213 _grail_mask_set_bit(*mask_len, mask, GRAIL_TYPE_DRAG5);
171 | (1 << GRAIL_TYPE_TAP5);214 _grail_mask_set_bit(*mask_len, mask, GRAIL_TYPE_PINCH5);
215 _grail_mask_set_bit(*mask_len, mask, GRAIL_TYPE_ROTATE5);
216 _grail_mask_set_bit(*mask_len, mask, GRAIL_TYPE_TAP5);
172217
173 if (sub_flags & GEIS_SUBSCRIPTION_CONT)218 if (sub_flags & GEIS_SUBSCRIPTION_CONT)
174 {219 {
175 *mask |= ( (1 << GRAIL_TYPE_EDRAG)220 _grail_mask_set_bit(*mask_len, mask, GRAIL_TYPE_EDRAG);
176 | (1 << GRAIL_TYPE_EPINCH)221 _grail_mask_set_bit(*mask_len, mask, GRAIL_TYPE_EPINCH);
177 | (1 << GRAIL_TYPE_EROTATE)222 _grail_mask_set_bit(*mask_len, mask, GRAIL_TYPE_EROTATE);
178 | (1 << GRAIL_TYPE_MDRAG)223 _grail_mask_set_bit(*mask_len, mask, GRAIL_TYPE_ETOUCH);
179 | (1 << GRAIL_TYPE_MPINCH)224 _grail_mask_set_bit(*mask_len, mask, GRAIL_TYPE_MDRAG);
180 | (1 << GRAIL_TYPE_MROTATE) );225 _grail_mask_set_bit(*mask_len, mask, GRAIL_TYPE_MPINCH);
226 _grail_mask_set_bit(*mask_len, mask, GRAIL_TYPE_MROTATE);
227 _grail_mask_set_bit(*mask_len, mask, GRAIL_TYPE_MTOUCH);
181 }228 }
182 else229 else
183 {230 {
184 *mask |= ( (1 << GRAIL_TYPE_DRAG3)231 _grail_mask_set_bit(*mask_len, mask, GRAIL_TYPE_DRAG3);
185 | (1 << GRAIL_TYPE_PINCH3)232 _grail_mask_set_bit(*mask_len, mask, GRAIL_TYPE_PINCH3);
186 | (1 << GRAIL_TYPE_ROTATE3)233 _grail_mask_set_bit(*mask_len, mask, GRAIL_TYPE_ROTATE3);
187 | (1 << GRAIL_TYPE_DRAG4)234 _grail_mask_set_bit(*mask_len, mask, GRAIL_TYPE_TOUCH3);
188 | (1 << GRAIL_TYPE_PINCH4)235 _grail_mask_set_bit(*mask_len, mask, GRAIL_TYPE_DRAG4);
189 | (1 << GRAIL_TYPE_ROTATE4) );236 _grail_mask_set_bit(*mask_len, mask, GRAIL_TYPE_PINCH4);
237 _grail_mask_set_bit(*mask_len, mask, GRAIL_TYPE_ROTATE4);
238 _grail_mask_set_bit(*mask_len, mask, GRAIL_TYPE_TOUCH4);
190 }239 }
191240
192241
@@ -194,7 +243,7 @@
194 {243 {
195 *mask |= (1 << GRAIL_TYPE_SYSFLAG1);244 *mask |= (1 << GRAIL_TYPE_SYSFLAG1);
196 }245 }
197geis_debug("initial bitmap is 0x%08x", *mask);246geis_debug("initial bitmap is 0x%08x %08x", mask[1], mask[0]);
198}247}
199248
200249
@@ -203,23 +252,25 @@
203 */252 */
204void253void
205geis_xcb_backend_gesture_bitmask_filter_class(GeisString class_name,254geis_xcb_backend_gesture_bitmask_filter_class(GeisString class_name,
206 uint32_t *mask_len __attribute__((unused)),255 uint32_t *mask_len,
207 uint32_t *mask)256 uint32_t *mask)
208{257{
209 uint32_t class_mask = 0;
210 const GrailClassMap *grail_class;258 const GrailClassMap *grail_class;
259 uint32_t class_mask[*mask_len];
260
261 _grail_mask_clear(*mask_len, class_mask);
211 for (grail_class = s_grail_class_map;262 for (grail_class = s_grail_class_map;
212 grail_class->geis_class_id >= 0;263 grail_class->geis_class_id >= 0;
213 ++grail_class)264 ++grail_class)
214 {265 {
215 if (0 == strcmp(grail_class->class_name, class_name))266 if (0 == strcmp(grail_class->class_name, class_name))
216 {267 {
217 class_mask |= _grail_bitmask_for(grail_class);268 _grail_mask_set_bit(*mask_len, class_mask, grail_class->grail_type);
218 }269 }
219 }270 }
220 *mask &= class_mask;271 _grail_mask_and(*mask_len, mask, class_mask);
221 geis_debug("class=\"%s\" mask=0x%08x bitmap is now 0x%08x",272 geis_debug("class=\"%s\" mask is 0x%08x %08x bitmap is now 0x%08x %08x",
222 class_name, class_mask, *mask);273 class_name, class_mask[1], class_mask[0], mask[1], mask[0]);
223}274}
224275
225276
@@ -230,11 +281,13 @@
230void281void
231geis_xcb_backend_gesture_bitmask_filter_touches(GeisSize min_touches,282geis_xcb_backend_gesture_bitmask_filter_touches(GeisSize min_touches,
232 GeisSize max_touches,283 GeisSize max_touches,
233 uint32_t *mask_len __attribute__((unused)),284 uint32_t *mask_len,
234 uint32_t *mask)285 uint32_t *mask)
235{286{
236 uint32_t touch_mask = 0;
237 const GrailClassMap *grail_class;287 const GrailClassMap *grail_class;
288 uint32_t touch_mask[*mask_len];
289
290 _grail_mask_clear(*mask_len, touch_mask);
238 for (grail_class = s_grail_class_map;291 for (grail_class = s_grail_class_map;
239 grail_class->geis_class_id >= 0;292 grail_class->geis_class_id >= 0;
240 ++grail_class)293 ++grail_class)
@@ -242,12 +295,12 @@
242 if (min_touches <= grail_class->touch_count295 if (min_touches <= grail_class->touch_count
243 && grail_class->touch_count <= max_touches)296 && grail_class->touch_count <= max_touches)
244 {297 {
245 touch_mask |= _grail_bitmask_for(grail_class);298 _grail_mask_set_bit(*mask_len, touch_mask, grail_class->grail_type);
246 }299 }
247 }300 }
248 *mask &= touch_mask;301 _grail_mask_and(*mask_len, mask, touch_mask);
249 geis_debug("min_touches=%lu max_touches=%lu mask=0x%08x bitmap is now 0x%08x",302 geis_debug("min_touches=%lu max_touches=%lu mask is 0x%08x %08x bitmap is now 0x%08x %08x",
250 min_touches, max_touches, touch_mask, *mask);303 min_touches, max_touches, touch_mask[1], touch_mask[0], mask[1], mask[0]);
251}304}
252305
253306
254307
=== modified file 'libutouch-geis/geis_v1.c'
--- libutouch-geis/geis_v1.c 2011-03-13 18:00:45 +0000
+++ libutouch-geis/geis_v1.c 2011-03-28 12:59:24 +0000
@@ -72,6 +72,11 @@
72 { GEIS_GESTURE_TYPE_TAP3, GEIS_GESTURE_TAP, 3 },72 { GEIS_GESTURE_TYPE_TAP3, GEIS_GESTURE_TAP, 3 },
73 { GEIS_GESTURE_TYPE_TAP4, GEIS_GESTURE_TAP, 4 },73 { GEIS_GESTURE_TYPE_TAP4, GEIS_GESTURE_TAP, 4 },
74 { GEIS_GESTURE_TYPE_TAP5, GEIS_GESTURE_TAP, 5 },74 { GEIS_GESTURE_TYPE_TAP5, GEIS_GESTURE_TAP, 5 },
75 { GEIS_GESTURE_TYPE_TOUCH1, GEIS_GESTURE_TOUCH, 1 },
76 { GEIS_GESTURE_TYPE_TOUCH2, GEIS_GESTURE_TOUCH, 2 },
77 { GEIS_GESTURE_TYPE_TOUCH3, GEIS_GESTURE_TOUCH, 3 },
78 { GEIS_GESTURE_TYPE_TOUCH4, GEIS_GESTURE_TOUCH, 4 },
79 { GEIS_GESTURE_TYPE_TOUCH5, GEIS_GESTURE_TOUCH, 5 },
75 { NULL, NULL, 0 }80 { NULL, NULL, 0 }
76};81};
7782
7883
=== modified file 'testsuite/geis1/Makefile.am'
--- testsuite/geis1/Makefile.am 2011-03-08 14:49:28 +0000
+++ testsuite/geis1/Makefile.am 2011-03-28 12:59:24 +0000
@@ -15,6 +15,7 @@
1515
16check_geis1_api_SOURCES = \16check_geis1_api_SOURCES = \
17 check_instance.c \17 check_instance.c \
18 check_gesture_types.c \
18 check_gesture_attrs.c \19 check_gesture_attrs.c \
19 check_geis1_api.c20 check_geis1_api.c
2021
2122
=== modified file 'testsuite/geis1/check_geis1_api.c'
--- testsuite/geis1/check_geis1_api.c 2011-03-08 14:49:28 +0000
+++ testsuite/geis1/check_geis1_api.c 2011-03-28 12:59:24 +0000
@@ -21,6 +21,7 @@
21#include <check.h>21#include <check.h>
2222
23extern Suite *geis1_instance_suite_new();23extern Suite *geis1_instance_suite_new();
24extern Suite *geis1_gesture_types_new();
24extern Suite *geis1_gesture_attrs_new();25extern Suite *geis1_gesture_attrs_new();
2526
26int27int
@@ -31,6 +32,7 @@
31 Suite *s = suite_create("GEIS v1.0 API");32 Suite *s = suite_create("GEIS v1.0 API");
32 SRunner *sr = srunner_create(s);33 SRunner *sr = srunner_create(s);
33 srunner_add_suite(sr, geis1_instance_suite_new());34 srunner_add_suite(sr, geis1_instance_suite_new());
35 srunner_add_suite(sr, geis1_gesture_types_new());
34 srunner_add_suite(sr, geis1_gesture_attrs_new());36 srunner_add_suite(sr, geis1_gesture_attrs_new());
3537
36 srunner_set_log(sr, "geis1_api.log");38 srunner_set_log(sr, "geis1_api.log");
3739
=== added file 'testsuite/geis1/check_gesture_types.c'
--- testsuite/geis1/check_gesture_types.c 1970-01-01 00:00:00 +0000
+++ testsuite/geis1/check_gesture_types.c 2011-03-28 12:59:24 +0000
@@ -0,0 +1,77 @@
1/**
2 * @file check_gesture_types.c
3 * @brief Unit tests for GEIS v1 gesture types
4 *
5 * Copyright 2011 Canonical Ltd.
6 *
7 * This library is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU Lesser General Public License as published by the Free
9 * Software Foundation; either version 3 of the License, or (at your option) any
10 * later version.
11 *
12 * This library is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
15 * details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21#include <check.h>
22
23#include <geis/geis.h>
24
25
26START_TEST(gesture_types)
27{
28 GeisInteger geis_type;
29 GeisString geis_type_name;
30
31 geis_type = GEIS_GESTURE_PRIMITIVE_DRAG;
32 geis_type = GEIS_GESTURE_PRIMITIVE_PINCH;
33 geis_type = GEIS_GESTURE_PRIMITIVE_ROTATE;
34 geis_type = GEIS_GESTURE_PRIMITIVE_TAP;
35 geis_type = GEIS_GESTURE_PRIMITIVE_TOUCH;
36
37 geis_type_name = GEIS_GESTURE_TYPE_DRAG1;
38 geis_type_name = GEIS_GESTURE_TYPE_DRAG2;
39 geis_type_name = GEIS_GESTURE_TYPE_DRAG3;
40 geis_type_name = GEIS_GESTURE_TYPE_DRAG4;
41 geis_type_name = GEIS_GESTURE_TYPE_DRAG5;
42 geis_type_name = GEIS_GESTURE_TYPE_PINCH1;
43 geis_type_name = GEIS_GESTURE_TYPE_PINCH2;
44 geis_type_name = GEIS_GESTURE_TYPE_PINCH3;
45 geis_type_name = GEIS_GESTURE_TYPE_PINCH4;
46 geis_type_name = GEIS_GESTURE_TYPE_PINCH5;
47 geis_type_name = GEIS_GESTURE_TYPE_ROTATE1;
48 geis_type_name = GEIS_GESTURE_TYPE_ROTATE2;
49 geis_type_name = GEIS_GESTURE_TYPE_ROTATE3;
50 geis_type_name = GEIS_GESTURE_TYPE_ROTATE4;
51 geis_type_name = GEIS_GESTURE_TYPE_ROTATE5;
52 geis_type_name = GEIS_GESTURE_TYPE_TAP1;
53 geis_type_name = GEIS_GESTURE_TYPE_TAP2;
54 geis_type_name = GEIS_GESTURE_TYPE_TAP3;
55 geis_type_name = GEIS_GESTURE_TYPE_TAP4;
56 geis_type_name = GEIS_GESTURE_TYPE_TAP5;
57 geis_type_name = GEIS_GESTURE_TYPE_TOUCH1;
58 geis_type_name = GEIS_GESTURE_TYPE_TOUCH2;
59 geis_type_name = GEIS_GESTURE_TYPE_TOUCH3;
60 geis_type_name = GEIS_GESTURE_TYPE_TOUCH4;
61 geis_type_name = GEIS_GESTURE_TYPE_TOUCH5;
62}
63END_TEST
64
65Suite *
66geis1_gesture_types_new()
67{
68 Suite *s = suite_create("geis1_gesture_types");
69 TCase *test;
70
71 test = tcase_create("gesture_types");
72 tcase_add_test(test, gesture_types);
73 suite_add_tcase(s, test);
74
75 return s;
76}
77
078
=== modified file 'testsuite/geistest/geistest.c'
--- testsuite/geistest/geistest.c 2011-03-22 16:35:35 +0000
+++ testsuite/geistest/geistest.c 2011-03-28 12:59:24 +0000
@@ -33,6 +33,7 @@
33 GEIS_GESTURE_TYPE_PINCH2, GEIS_GESTURE_TYPE_PINCH3,33 GEIS_GESTURE_TYPE_PINCH2, GEIS_GESTURE_TYPE_PINCH3,
34 GEIS_GESTURE_TYPE_ROTATE2, GEIS_GESTURE_TYPE_ROTATE3,34 GEIS_GESTURE_TYPE_ROTATE2, GEIS_GESTURE_TYPE_ROTATE3,
35 GEIS_GESTURE_TYPE_TAP2, GEIS_GESTURE_TYPE_TAP3, GEIS_GESTURE_TYPE_TAP4,35 GEIS_GESTURE_TYPE_TAP2, GEIS_GESTURE_TYPE_TAP3, GEIS_GESTURE_TYPE_TAP4,
36 GEIS_GESTURE_TYPE_TOUCH3, GEIS_GESTURE_TYPE_TOUCH4,
36 NULL37 NULL
37};38};
3839

Subscribers

People subscribed via source and target branches