Merge lp:~oif-team/geis/geis2-add-device into lp:geis
- geis2-add-device
- Merge into trunk
Proposed by
Stephen M. Webb
Status: | Merged |
---|---|
Merged at revision: | 98 |
Proposed branch: | lp:~oif-team/geis/geis2-add-device |
Merge into: | lp:geis |
Diff against target: |
1099 lines (+802/-161) 12 files modified
ChangeLog (+36/-0) include/geis/geis.h (+230/-160) libutouch-geis/Makefile.am (+1/-0) libutouch-geis/geis_device.c (+273/-0) libutouch-geis/geis_device.h (+104/-0) libutouch-geis/libutouch-geis.ver (+7/-0) testsuite/geis2/Makefile.am (+1/-0) testsuite/geis2/check_device.c (+45/-0) testsuite/geis2/check_geis2_api.c (+2/-0) testsuite/libutouch-geis/Makefile.am (+2/-1) testsuite/libutouch-geis/check_device.c (+99/-0) testsuite/libutouch-geis/check_geis2_internals.c (+2/-0) |
To merge this branch: | bzr merge lp:~oif-team/geis/geis2-add-device |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Henrik Rydberg (community) | Approve | ||
Review via email: mp+44341@code.launchpad.net |
Commit message
Description of the change
Added GEIS v2.0 device module
To post a comment you must log in.
Revision history for this message
Stephen M. Webb (bregma) wrote : | # |
I think you mean the geis.h header.
I had to rearrange a chunk of stuff in include/geis/geis.h to move the GeisEvent declarations before the GeisDevice declarations. It looks like a big diff because the diff machine saw this as moving everything else but the GeisEvent section around. the GeisRegion and GeisSubscriptions chunks are in fact unchanged.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'ChangeLog' | |||
2 | --- ChangeLog 2010-12-20 18:06:36 +0000 | |||
3 | +++ ChangeLog 2010-12-21 14:03:26 +0000 | |||
4 | @@ -1,5 +1,41 @@ | |||
5 | 1 | 2010-12-20 Stephen M. Webb <stephen.webb@canonical.com> | 1 | 2010-12-20 Stephen M. Webb <stephen.webb@canonical.com> |
6 | 2 | 2 | ||
7 | 3 | Added GEIS v2.0 input device implementation. | ||
8 | 4 | |||
9 | 5 | * libutouch-geis/geis_device.h (GeisDeviceBag): new type | ||
10 | 6 | (geis_device_bag_new): new function | ||
11 | 7 | (geis_device_bag_delete): new function | ||
12 | 8 | (geis_device_bag_count): new function | ||
13 | 9 | (geis_device_bag_device): new function | ||
14 | 10 | (geis_device_bag_insert): new function | ||
15 | 11 | (geis_device_bag_remove): new function | ||
16 | 12 | * libutouch-geis/geis_device.c: implemented new functions | ||
17 | 13 | * testsuite/libutouch-geis/check_device.c: new test suite | ||
18 | 14 | * testsuite/libutouch-geis/Makefile.am: added new test suite | ||
19 | 15 | * testsuite/libutouch-geis/check_geis2_internals.c: added new test suite | ||
20 | 16 | |||
21 | 17 | 2010-12-20 Stephen M. Webb <stephen.webb@canonical.com> | ||
22 | 18 | |||
23 | 19 | Added GEIS v2.0 input device API | ||
24 | 20 | |||
25 | 21 | * libutouch-geis/geis_device.c: new file | ||
26 | 22 | * libutouch-geis/geis_device.h: new file | ||
27 | 23 | * testsuite/geis2/check_device.c: new test suite | ||
28 | 24 | * include/geis/geis.h (GeisDevice): new type | ||
29 | 25 | (geis_register_device_callback): new function | ||
30 | 26 | (geis_device_ref): new function | ||
31 | 27 | (geis_device_unref): new function | ||
32 | 28 | (geis_device_name): new function | ||
33 | 29 | (geis_device_id): new function | ||
34 | 30 | (geis_device_attr_count): new function | ||
35 | 31 | (geis_device_attr): new function | ||
36 | 32 | * libutouch-geis/Makefile.am: added new files | ||
37 | 33 | * libutouch-geis/libutouch-geis.ver: added new API symbols | ||
38 | 34 | * testsuite/geis2/Makefile.am: added new test suite | ||
39 | 35 | * testsuite/geis2/check_geis2_api.c: added new test suite | ||
40 | 36 | |||
41 | 37 | 2010-12-20 Stephen M. Webb <stephen.webb@canonical.com> | ||
42 | 38 | |||
43 | 3 | Updates to match new GEIS v2.0 spec release of 2010.12.20. | 39 | Updates to match new GEIS v2.0 spec release of 2010.12.20. |
44 | 4 | - added a pointer type to the GEIS attr module | 40 | - added a pointer type to the GEIS attr module |
45 | 5 | - added additional required GEIS initialization arguments | 41 | - added additional required GEIS initialization arguments |
46 | 6 | 42 | ||
47 | === modified file 'include/geis/geis.h' | |||
48 | --- include/geis/geis.h 2010-12-20 18:06:36 +0000 | |||
49 | +++ include/geis/geis.h 2010-12-21 14:03:26 +0000 | |||
50 | @@ -658,166 +658,6 @@ | |||
51 | 658 | /* @} */ | 658 | /* @} */ |
52 | 659 | 659 | ||
53 | 660 | /** | 660 | /** |
54 | 661 | * @defgroup geis2_region Gesture Regions (GEIS v2.0) | ||
55 | 662 | * @{ | ||
56 | 663 | */ | ||
57 | 664 | |||
58 | 665 | typedef struct _GeisRegion *GeisRegion; | ||
59 | 666 | |||
60 | 667 | /** | ||
61 | 668 | * @defgroup geis2_region_init_args Gesture Region Initialization Arguments | ||
62 | 669 | * | ||
63 | 670 | * Gesture regions are created to describe a particular display/feedback region. | ||
64 | 671 | * The type of the region can not be changed after creation (just create a new | ||
65 | 672 | * region for that). The types of regions are platform specific and each type | ||
66 | 673 | * may require addition arguments. | ||
67 | 674 | * | ||
68 | 675 | * The following region initialization argument names are required by the | ||
69 | 676 | * GEIS v2.0 specification. | ||
70 | 677 | * | ||
71 | 678 | * @{ | ||
72 | 679 | */ | ||
73 | 680 | #define GEIS_REGION_X11_ROOT "org.libgeis.region.x11.root" | ||
74 | 681 | #define GEIS_REGION_X11_WINDOWID "org.libgeis.region.x11.windowid" | ||
75 | 682 | |||
76 | 683 | /* @} */ | ||
77 | 684 | |||
78 | 685 | /** | ||
79 | 686 | * Creates a new GEIS v2.0 region. | ||
80 | 687 | * | ||
81 | 688 | * @param[in] geis The GEIS API instance. | ||
82 | 689 | * @param[in] name A name. Used for diagnostics. | ||
83 | 690 | * @param[in] init_arg_name The name of the first initialization argument. | ||
84 | 691 | * | ||
85 | 692 | * The initialization argument list must be terminated by a NULL. | ||
86 | 693 | * | ||
87 | 694 | * @returns a newly created region, or NULL on failure. | ||
88 | 695 | */ | ||
89 | 696 | GEIS_API GeisRegion geis_region_new(Geis geis, | ||
90 | 697 | GeisString name, | ||
91 | 698 | GeisString init_arg_name, ...); | ||
92 | 699 | |||
93 | 700 | /** | ||
94 | 701 | * Destroys a GEIS v2.0 region. | ||
95 | 702 | * | ||
96 | 703 | * @param[in] region The region. | ||
97 | 704 | */ | ||
98 | 705 | GEIS_API GeisStatus geis_region_delete(GeisRegion region); | ||
99 | 706 | |||
100 | 707 | /** | ||
101 | 708 | * Gets the name of a GEIS v2.0 region. | ||
102 | 709 | * | ||
103 | 710 | * @param[in] region The region. | ||
104 | 711 | * | ||
105 | 712 | * Returns the @p name value used when creating the region. | ||
106 | 713 | */ | ||
107 | 714 | GEIS_API GeisString geis_region_name(GeisRegion region); | ||
108 | 715 | |||
109 | 716 | /* @} */ | ||
110 | 717 | |||
111 | 718 | /** | ||
112 | 719 | * @defgroup geis2_subscription Gesture Subscription (GEIS v2.0) | ||
113 | 720 | * @{ | ||
114 | 721 | */ | ||
115 | 722 | |||
116 | 723 | typedef struct _GeisFilter *GeisFilter; | ||
117 | 724 | typedef struct _GeisSubscription *GeisSubscription; | ||
118 | 725 | |||
119 | 726 | /** | ||
120 | 727 | * Flags to refine the behaviour of the gesture subscription. | ||
121 | 728 | */ | ||
122 | 729 | typedef enum _GeisSubscriptionFlags | ||
123 | 730 | { | ||
124 | 731 | GEIS_SUBSCRIPTION_NONE = 0x0000, | ||
125 | 732 | GEIS_SUBSCRIPTION_GRAB = 0x0001, | ||
126 | 733 | GEIS_SUBSCRIPTION_CONT = 0x0002 | ||
127 | 734 | } GeisSubscriptionFlags; | ||
128 | 735 | |||
129 | 736 | /** | ||
130 | 737 | * Creates a new subscription. | ||
131 | 738 | * | ||
132 | 739 | * @param[in] geis The GEIS API instance. | ||
133 | 740 | * @param[in] name A name. | ||
134 | 741 | * @param[in] flags Some flags. | ||
135 | 742 | * | ||
136 | 743 | * @returns a GeisSubscription object or NULL on failure. | ||
137 | 744 | * | ||
138 | 745 | * A gesture subscription is required for any gesture events to be delivered | ||
139 | 746 | * from the GEIS API. | ||
140 | 747 | */ | ||
141 | 748 | GEIS_API GeisSubscription geis_subscription_new(Geis geis, | ||
142 | 749 | GeisString name, | ||
143 | 750 | GeisSubscriptionFlags flags); | ||
144 | 751 | |||
145 | 752 | /** | ||
146 | 753 | * Destroys a GEIS v2.0 subscription object. | ||
147 | 754 | * | ||
148 | 755 | * @param[in] subscription The subscription. | ||
149 | 756 | */ | ||
150 | 757 | GEIS_API GeisStatus geis_subscription_delete(GeisSubscription subscription); | ||
151 | 758 | |||
152 | 759 | /** | ||
153 | 760 | * Activates a subscription. | ||
154 | 761 | * | ||
155 | 762 | * @param[in] subscription The subscription. | ||
156 | 763 | * | ||
157 | 764 | * Puts the subscription into the active state. Gesture events will be | ||
158 | 765 | * delivered for this subscription. | ||
159 | 766 | */ | ||
160 | 767 | GEIS_API GeisStatus geis_subscription_activate(GeisSubscription subscription); | ||
161 | 768 | |||
162 | 769 | /** | ||
163 | 770 | * Deactivates a subscription. | ||
164 | 771 | * | ||
165 | 772 | * @param[in] subscription The subscription. | ||
166 | 773 | * | ||
167 | 774 | * Puts the subscription into the inactive state. Gesture events will not be | ||
168 | 775 | * delivered for this subscription. | ||
169 | 776 | */ | ||
170 | 777 | GEIS_API GeisStatus geis_subscription_deactivate(GeisSubscription subscription); | ||
171 | 778 | |||
172 | 779 | /** | ||
173 | 780 | * Gets the name given to a subscription when it was created. | ||
174 | 781 | * | ||
175 | 782 | * @param[in] subscription The subscription. | ||
176 | 783 | */ | ||
177 | 784 | GEIS_API GeisString geis_subscription_name(GeisSubscription subscription); | ||
178 | 785 | |||
179 | 786 | /** | ||
180 | 787 | * Gets the ID assigned to a subscription when it was created. | ||
181 | 788 | * | ||
182 | 789 | * @param[in] subscription The subscription. | ||
183 | 790 | */ | ||
184 | 791 | GEIS_API GeisInteger geis_subscription_id(GeisSubscription subscription); | ||
185 | 792 | |||
186 | 793 | /** | ||
187 | 794 | * Adds a filter to a subscription. | ||
188 | 795 | * | ||
189 | 796 | * @param[in] subscription The subscription. | ||
190 | 797 | * @param[in] filter The filter to be added to the subscription. | ||
191 | 798 | * | ||
192 | 799 | * Thye effect of filters are ANDed together so that, for example, a | ||
193 | 800 | * subscription that has a filter for 3-finger gestures and drag gestures will | ||
194 | 801 | * produce events only for 3-finger drag gestures. | ||
195 | 802 | * | ||
196 | 803 | * The default is no filters: that is, all possible gesture events will be | ||
197 | 804 | * reported. | ||
198 | 805 | */ | ||
199 | 806 | GEIS_API GeisStatus geis_subscription_add_filter(GeisSubscription subscription, | ||
200 | 807 | GeisFilter filter); | ||
201 | 808 | |||
202 | 809 | /** | ||
203 | 810 | * Removes a filter from a subscription. | ||
204 | 811 | * | ||
205 | 812 | * @param[in] subscription The subscription. | ||
206 | 813 | * @param[in] filter The filter to be removed from the subscription. | ||
207 | 814 | */ | ||
208 | 815 | GEIS_API GeisStatus geis_subscription_remove_filter(GeisSubscription subscription, | ||
209 | 816 | GeisFilter filter); | ||
210 | 817 | |||
211 | 818 | /* @} */ | ||
212 | 819 | |||
213 | 820 | /** | ||
214 | 821 | * @defgroup geis2_event_control Event Control (GEIS v2.0) | 661 | * @defgroup geis2_event_control Event Control (GEIS v2.0) |
215 | 822 | * | 662 | * |
216 | 823 | * These functions are used to dispatch events generated from the various other | 663 | * These functions are used to dispatch events generated from the various other |
217 | @@ -978,6 +818,236 @@ | |||
218 | 978 | 818 | ||
219 | 979 | /* @} */ | 819 | /* @} */ |
220 | 980 | 820 | ||
221 | 821 | /** | ||
222 | 822 | * @defgroup geis2_device Gesture Input Devices (GEIS v2.0) | ||
223 | 823 | * @{ | ||
224 | 824 | */ | ||
225 | 825 | |||
226 | 826 | /** | ||
227 | 827 | * An opaque pointer type representing a gesture-capable input device. | ||
228 | 828 | * | ||
229 | 829 | * GeisDevice objects are created by the GEIS API and are reference counted. | ||
230 | 830 | */ | ||
231 | 831 | typedef struct _GeisDevice *GeisDevice; | ||
232 | 832 | |||
233 | 833 | GEIS_API void geis_register_device_callback(Geis geis, | ||
234 | 834 | GeisEventCallback event_callback, | ||
235 | 835 | void *context); | ||
236 | 836 | |||
237 | 837 | /** | ||
238 | 838 | * Adds a reference count to a device. | ||
239 | 839 | * | ||
240 | 840 | * @param[in] device The device. | ||
241 | 841 | * | ||
242 | 842 | * An application that wishes to guarantee the device object remains valid | ||
243 | 843 | * should add a reference using this call, and unref when the object is no | ||
244 | 844 | * longer needed. | ||
245 | 845 | */ | ||
246 | 846 | GEIS_API void geis_device_ref(GeisDevice device); | ||
247 | 847 | |||
248 | 848 | /** | ||
249 | 849 | * Removes a reference count from a device. | ||
250 | 850 | * | ||
251 | 851 | * @param[in] device The device. | ||
252 | 852 | * | ||
253 | 853 | * This function decrements the number of references to the device and, if the | ||
254 | 854 | * number of references hits zero, deletes the device. | ||
255 | 855 | */ | ||
256 | 856 | GEIS_API void geis_device_unref(GeisDevice device); | ||
257 | 857 | |||
258 | 858 | /** | ||
259 | 859 | * Gets the name of teh input device. | ||
260 | 860 | * | ||
261 | 861 | * @param[in] device The device. | ||
262 | 862 | */ | ||
263 | 863 | GEIS_API GeisString geis_device_name(GeisDevice device); | ||
264 | 864 | |||
265 | 865 | /** | ||
266 | 866 | * Gets the system identifier of the iput device. | ||
267 | 867 | * | ||
268 | 868 | * @param[in] device The device. | ||
269 | 869 | * | ||
270 | 870 | * The system-defined device identifier is system- and possibly | ||
271 | 871 | * device-dependent. | ||
272 | 872 | */ | ||
273 | 873 | GEIS_API GeisInteger geis_device_id(GeisDevice device); | ||
274 | 874 | |||
275 | 875 | /** | ||
276 | 876 | * Gets the number of attributes of the device. | ||
277 | 877 | * | ||
278 | 878 | * @param[in] device The device. | ||
279 | 879 | */ | ||
280 | 880 | GEIS_API GeisSize geis_device_attr_count(GeisDevice device); | ||
281 | 881 | |||
282 | 882 | /** | ||
283 | 883 | * Gets the indicated attribute of the device. | ||
284 | 884 | * | ||
285 | 885 | * @param[in] device The device. | ||
286 | 886 | */ | ||
287 | 887 | GEIS_API GeisAttr geis_device_attr(GeisDevice device, GeisSize index); | ||
288 | 888 | |||
289 | 889 | /* @} */ | ||
290 | 890 | |||
291 | 891 | /** | ||
292 | 892 | * @defgroup geis2_region Gesture Regions (GEIS v2.0) | ||
293 | 893 | * @{ | ||
294 | 894 | */ | ||
295 | 895 | |||
296 | 896 | typedef struct _GeisRegion *GeisRegion; | ||
297 | 897 | |||
298 | 898 | /** | ||
299 | 899 | * @defgroup geis2_region_init_args Gesture Region Initialization Arguments | ||
300 | 900 | * | ||
301 | 901 | * Gesture regions are created to describe a particular display/feedback region. | ||
302 | 902 | * The type of the region can not be changed after creation (just create a new | ||
303 | 903 | * region for that). The types of regions are platform specific and each type | ||
304 | 904 | * may require addition arguments. | ||
305 | 905 | * | ||
306 | 906 | * The following region initialization argument names are required by the | ||
307 | 907 | * GEIS v2.0 specification. | ||
308 | 908 | * | ||
309 | 909 | * @{ | ||
310 | 910 | */ | ||
311 | 911 | #define GEIS_REGION_X11_ROOT "org.libgeis.region.x11.root" | ||
312 | 912 | #define GEIS_REGION_X11_WINDOWID "org.libgeis.region.x11.windowid" | ||
313 | 913 | |||
314 | 914 | /* @} */ | ||
315 | 915 | |||
316 | 916 | /** | ||
317 | 917 | * Creates a new GEIS v2.0 region. | ||
318 | 918 | * | ||
319 | 919 | * @param[in] geis The GEIS API instance. | ||
320 | 920 | * @param[in] name A name. Used for diagnostics. | ||
321 | 921 | * @param[in] init_arg_name The name of the first initialization argument. | ||
322 | 922 | * | ||
323 | 923 | * The initialization argument list must be terminated by a NULL. | ||
324 | 924 | * | ||
325 | 925 | * @returns a newly created region, or NULL on failure. | ||
326 | 926 | */ | ||
327 | 927 | GEIS_API GeisRegion geis_region_new(Geis geis, | ||
328 | 928 | GeisString name, | ||
329 | 929 | GeisString init_arg_name, ...); | ||
330 | 930 | |||
331 | 931 | /** | ||
332 | 932 | * Destroys a GEIS v2.0 region. | ||
333 | 933 | * | ||
334 | 934 | * @param[in] region The region. | ||
335 | 935 | */ | ||
336 | 936 | GEIS_API GeisStatus geis_region_delete(GeisRegion region); | ||
337 | 937 | |||
338 | 938 | /** | ||
339 | 939 | * Gets the name of a GEIS v2.0 region. | ||
340 | 940 | * | ||
341 | 941 | * @param[in] region The region. | ||
342 | 942 | * | ||
343 | 943 | * Returns the @p name value used when creating the region. | ||
344 | 944 | */ | ||
345 | 945 | GEIS_API GeisString geis_region_name(GeisRegion region); | ||
346 | 946 | |||
347 | 947 | /* @} */ | ||
348 | 948 | |||
349 | 949 | /** | ||
350 | 950 | * @defgroup geis2_subscription Gesture Subscription (GEIS v2.0) | ||
351 | 951 | * @{ | ||
352 | 952 | */ | ||
353 | 953 | |||
354 | 954 | typedef struct _GeisFilter *GeisFilter; | ||
355 | 955 | typedef struct _GeisSubscription *GeisSubscription; | ||
356 | 956 | |||
357 | 957 | /** | ||
358 | 958 | * Flags to refine the behaviour of the gesture subscription. | ||
359 | 959 | */ | ||
360 | 960 | typedef enum _GeisSubscriptionFlags | ||
361 | 961 | { | ||
362 | 962 | GEIS_SUBSCRIPTION_NONE = 0x0000, | ||
363 | 963 | GEIS_SUBSCRIPTION_GRAB = 0x0001, | ||
364 | 964 | GEIS_SUBSCRIPTION_CONT = 0x0002 | ||
365 | 965 | } GeisSubscriptionFlags; | ||
366 | 966 | |||
367 | 967 | /** | ||
368 | 968 | * Creates a new subscription. | ||
369 | 969 | * | ||
370 | 970 | * @param[in] geis The GEIS API instance. | ||
371 | 971 | * @param[in] name A name. | ||
372 | 972 | * @param[in] flags Some flags. | ||
373 | 973 | * | ||
374 | 974 | * @returns a GeisSubscription object or NULL on failure. | ||
375 | 975 | * | ||
376 | 976 | * A gesture subscription is required for any gesture events to be delivered | ||
377 | 977 | * from the GEIS API. | ||
378 | 978 | */ | ||
379 | 979 | GEIS_API GeisSubscription geis_subscription_new(Geis geis, | ||
380 | 980 | GeisString name, | ||
381 | 981 | GeisSubscriptionFlags flags); | ||
382 | 982 | |||
383 | 983 | /** | ||
384 | 984 | * Destroys a GEIS v2.0 subscription object. | ||
385 | 985 | * | ||
386 | 986 | * @param[in] subscription The subscription. | ||
387 | 987 | */ | ||
388 | 988 | GEIS_API GeisStatus geis_subscription_delete(GeisSubscription subscription); | ||
389 | 989 | |||
390 | 990 | /** | ||
391 | 991 | * Activates a subscription. | ||
392 | 992 | * | ||
393 | 993 | * @param[in] subscription The subscription. | ||
394 | 994 | * | ||
395 | 995 | * Puts the subscription into the active state. Gesture events will be | ||
396 | 996 | * delivered for this subscription. | ||
397 | 997 | */ | ||
398 | 998 | GEIS_API GeisStatus geis_subscription_activate(GeisSubscription subscription); | ||
399 | 999 | |||
400 | 1000 | /** | ||
401 | 1001 | * Deactivates a subscription. | ||
402 | 1002 | * | ||
403 | 1003 | * @param[in] subscription The subscription. | ||
404 | 1004 | * | ||
405 | 1005 | * Puts the subscription into the inactive state. Gesture events will not be | ||
406 | 1006 | * delivered for this subscription. | ||
407 | 1007 | */ | ||
408 | 1008 | GEIS_API GeisStatus geis_subscription_deactivate(GeisSubscription subscription); | ||
409 | 1009 | |||
410 | 1010 | /** | ||
411 | 1011 | * Gets the name given to a subscription when it was created. | ||
412 | 1012 | * | ||
413 | 1013 | * @param[in] subscription The subscription. | ||
414 | 1014 | */ | ||
415 | 1015 | GEIS_API GeisString geis_subscription_name(GeisSubscription subscription); | ||
416 | 1016 | |||
417 | 1017 | /** | ||
418 | 1018 | * Gets the ID assigned to a subscription when it was created. | ||
419 | 1019 | * | ||
420 | 1020 | * @param[in] subscription The subscription. | ||
421 | 1021 | */ | ||
422 | 1022 | GEIS_API GeisInteger geis_subscription_id(GeisSubscription subscription); | ||
423 | 1023 | |||
424 | 1024 | /** | ||
425 | 1025 | * Adds a filter to a subscription. | ||
426 | 1026 | * | ||
427 | 1027 | * @param[in] subscription The subscription. | ||
428 | 1028 | * @param[in] filter The filter to be added to the subscription. | ||
429 | 1029 | * | ||
430 | 1030 | * Thye effect of filters are ANDed together so that, for example, a | ||
431 | 1031 | * subscription that has a filter for 3-finger gestures and drag gestures will | ||
432 | 1032 | * produce events only for 3-finger drag gestures. | ||
433 | 1033 | * | ||
434 | 1034 | * The default is no filters: that is, all possible gesture events will be | ||
435 | 1035 | * reported. | ||
436 | 1036 | */ | ||
437 | 1037 | GEIS_API GeisStatus geis_subscription_add_filter(GeisSubscription subscription, | ||
438 | 1038 | GeisFilter filter); | ||
439 | 1039 | |||
440 | 1040 | /** | ||
441 | 1041 | * Removes a filter from a subscription. | ||
442 | 1042 | * | ||
443 | 1043 | * @param[in] subscription The subscription. | ||
444 | 1044 | * @param[in] filter The filter to be removed from the subscription. | ||
445 | 1045 | */ | ||
446 | 1046 | GEIS_API GeisStatus geis_subscription_remove_filter(GeisSubscription subscription, | ||
447 | 1047 | GeisFilter filter); | ||
448 | 1048 | |||
449 | 1049 | /* @} */ | ||
450 | 1050 | |||
451 | 981 | #ifdef __cplusplus | 1051 | #ifdef __cplusplus |
452 | 982 | } // extern "C" | 1052 | } // extern "C" |
453 | 983 | #endif | 1053 | #endif |
454 | 984 | 1054 | ||
455 | === modified file 'libutouch-geis/Makefile.am' | |||
456 | --- libutouch-geis/Makefile.am 2010-12-20 18:06:36 +0000 | |||
457 | +++ libutouch-geis/Makefile.am 2010-12-21 14:03:26 +0000 | |||
458 | @@ -28,6 +28,7 @@ | |||
459 | 28 | geis_backend_protected.h \ | 28 | geis_backend_protected.h \ |
460 | 29 | geis_backend_multiplexor.h geis_backend_multiplexor.c \ | 29 | geis_backend_multiplexor.h geis_backend_multiplexor.c \ |
461 | 30 | geis_backend_test_fixture.h geis_backend_test_fixture.c \ | 30 | geis_backend_test_fixture.h geis_backend_test_fixture.c \ |
462 | 31 | geis_device.h geis_device.c \ | ||
463 | 31 | geis_error.h geis_error.c \ | 32 | geis_error.h geis_error.c \ |
464 | 32 | geis_event.h geis_event.c \ | 33 | geis_event.h geis_event.c \ |
465 | 33 | geis_event_queue.h geis_event_queue.c \ | 34 | geis_event_queue.h geis_event_queue.c \ |
466 | 34 | 35 | ||
467 | === added file 'libutouch-geis/geis_device.c' | |||
468 | --- libutouch-geis/geis_device.c 1970-01-01 00:00:00 +0000 | |||
469 | +++ libutouch-geis/geis_device.c 2010-12-21 14:03:26 +0000 | |||
470 | @@ -0,0 +1,273 @@ | |||
471 | 1 | /** | ||
472 | 2 | * @file libutouch-geis/geis_region.c | ||
473 | 3 | * @brief implementation of the uTouch GEIS v2.0 API Input Device module | ||
474 | 4 | * | ||
475 | 5 | * Copyright 2010 Canonical Ltd. | ||
476 | 6 | * | ||
477 | 7 | * This library is free software; you can redistribute it and/or modify it under | ||
478 | 8 | * the terms of the GNU Lesser General Public License as published by the Free | ||
479 | 9 | * Software Foundation; either version 3 of the License, or (at your option) any | ||
480 | 10 | * later version. | ||
481 | 11 | * | ||
482 | 12 | * This library is distributed in the hope that it will be useful, but WITHOUT | ||
483 | 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
484 | 14 | * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more | ||
485 | 15 | * details. | ||
486 | 16 | * | ||
487 | 17 | * You should have received a copy of the GNU Lesser General Public License | ||
488 | 18 | * along with this program; if not, write to the Free Software Foundation, Inc., | ||
489 | 19 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
490 | 20 | */ | ||
491 | 21 | #include "geis_config.h" | ||
492 | 22 | #include "geis_device.h" | ||
493 | 23 | |||
494 | 24 | #include "geis_attr.h" | ||
495 | 25 | #include "geis_logging.h" | ||
496 | 26 | #include <stdlib.h> | ||
497 | 27 | #include <string.h> | ||
498 | 28 | |||
499 | 29 | |||
500 | 30 | struct _GeisDevice | ||
501 | 31 | { | ||
502 | 32 | GeisSize ref_count; | ||
503 | 33 | GeisString name; | ||
504 | 34 | GeisInteger id; | ||
505 | 35 | GeisAttrBag attr_bag; | ||
506 | 36 | }; | ||
507 | 37 | |||
508 | 38 | struct _GeisDeviceBag | ||
509 | 39 | { | ||
510 | 40 | GeisDevice *device_store; | ||
511 | 41 | GeisSize device_store_size; | ||
512 | 42 | GeisSize device_count; | ||
513 | 43 | }; | ||
514 | 44 | |||
515 | 45 | static const int device_bag_growth_constant = 2; | ||
516 | 46 | |||
517 | 47 | |||
518 | 48 | GeisDeviceBag | ||
519 | 49 | geis_device_bag_new() | ||
520 | 50 | { | ||
521 | 51 | GeisDeviceBag bag = calloc(1, sizeof(struct _GeisDeviceBag)); | ||
522 | 52 | if (!bag) | ||
523 | 53 | { | ||
524 | 54 | geis_error("error allocating device bag"); | ||
525 | 55 | goto final_exit; | ||
526 | 56 | } | ||
527 | 57 | |||
528 | 58 | bag->device_store = calloc(1, sizeof(struct _GeisDevice)); | ||
529 | 59 | if (!bag->device_store) | ||
530 | 60 | { | ||
531 | 61 | geis_error("error allocating device bag store"); | ||
532 | 62 | goto unwind_bag; | ||
533 | 63 | } | ||
534 | 64 | |||
535 | 65 | bag->device_store_size = 1; | ||
536 | 66 | bag->device_count = 0; | ||
537 | 67 | goto final_exit; | ||
538 | 68 | |||
539 | 69 | unwind_bag: | ||
540 | 70 | free(bag); | ||
541 | 71 | bag = NULL; | ||
542 | 72 | final_exit: | ||
543 | 73 | return bag; | ||
544 | 74 | } | ||
545 | 75 | |||
546 | 76 | |||
547 | 77 | void | ||
548 | 78 | geis_device_bag_delete(GeisDeviceBag bag) | ||
549 | 79 | { | ||
550 | 80 | GeisSize i; | ||
551 | 81 | for (i = bag->device_count; i > 0; --i) | ||
552 | 82 | { | ||
553 | 83 | geis_device_unref(bag->device_store[i-1]); | ||
554 | 84 | } | ||
555 | 85 | free(bag->device_store); | ||
556 | 86 | free(bag); | ||
557 | 87 | } | ||
558 | 88 | |||
559 | 89 | |||
560 | 90 | GeisSize | ||
561 | 91 | geis_device_bag_count(GeisDeviceBag bag) | ||
562 | 92 | { | ||
563 | 93 | return bag->device_count; | ||
564 | 94 | } | ||
565 | 95 | |||
566 | 96 | |||
567 | 97 | GeisDevice | ||
568 | 98 | geis_device_bag_device(GeisDeviceBag bag, GeisSize index) | ||
569 | 99 | { | ||
570 | 100 | GeisDevice device = NULL; | ||
571 | 101 | if (index >= bag->device_count) | ||
572 | 102 | { | ||
573 | 103 | geis_warning("device bag index out of range"); | ||
574 | 104 | } | ||
575 | 105 | else | ||
576 | 106 | { | ||
577 | 107 | device = bag->device_store[index]; | ||
578 | 108 | } | ||
579 | 109 | return device; | ||
580 | 110 | } | ||
581 | 111 | |||
582 | 112 | |||
583 | 113 | GeisStatus | ||
584 | 114 | geis_device_bag_insert(GeisDeviceBag bag, GeisDevice device) | ||
585 | 115 | { | ||
586 | 116 | GeisStatus status = GEIS_STATUS_UNKNOWN_ERROR; | ||
587 | 117 | if (bag->device_count >= bag->device_store_size) | ||
588 | 118 | { | ||
589 | 119 | GeisSize new_store_size = bag->device_store_size * device_bag_growth_constant; | ||
590 | 120 | GeisDevice *new_store = realloc(bag->device_store, | ||
591 | 121 | new_store_size * sizeof(struct _GeisDevice)); | ||
592 | 122 | if (!new_store) | ||
593 | 123 | { | ||
594 | 124 | geis_error("failed to reallocate device bag"); | ||
595 | 125 | goto error_exit; | ||
596 | 126 | } | ||
597 | 127 | bag->device_store = new_store; | ||
598 | 128 | bag->device_store_size = new_store_size; | ||
599 | 129 | } | ||
600 | 130 | bag->device_store[bag->device_count++] = device; | ||
601 | 131 | status = GEIS_STATUS_SUCCESS; | ||
602 | 132 | |||
603 | 133 | error_exit: | ||
604 | 134 | return status; | ||
605 | 135 | } | ||
606 | 136 | |||
607 | 137 | GeisStatus | ||
608 | 138 | geis_device_bag_remove(GeisDeviceBag bag, GeisDevice device) | ||
609 | 139 | { | ||
610 | 140 | GeisSize i; | ||
611 | 141 | GeisStatus status = GEIS_STATUS_SUCCESS; | ||
612 | 142 | for (i = 0; i < bag->device_count; ++i) | ||
613 | 143 | { | ||
614 | 144 | if (bag->device_store[i] == device) | ||
615 | 145 | { | ||
616 | 146 | GeisSize j; | ||
617 | 147 | geis_device_unref(bag->device_store[i]); | ||
618 | 148 | --bag->device_count; | ||
619 | 149 | for (j = i; j < bag->device_count; ++j) | ||
620 | 150 | { | ||
621 | 151 | bag->device_store[j] = bag->device_store[j+1]; | ||
622 | 152 | } | ||
623 | 153 | break; | ||
624 | 154 | } | ||
625 | 155 | } | ||
626 | 156 | return status; | ||
627 | 157 | } | ||
628 | 158 | |||
629 | 159 | |||
630 | 160 | /* | ||
631 | 161 | * Creates a new, empty device. | ||
632 | 162 | */ | ||
633 | 163 | GeisDevice | ||
634 | 164 | geis_device_new(GeisString name, GeisInteger id) | ||
635 | 165 | { | ||
636 | 166 | GeisDevice device = calloc(1, sizeof(struct _GeisDevice)); | ||
637 | 167 | if (!device) | ||
638 | 168 | { | ||
639 | 169 | geis_error("error allocating input device"); | ||
640 | 170 | goto final_exit; | ||
641 | 171 | } | ||
642 | 172 | |||
643 | 173 | device->attr_bag = geis_attr_bag_new(4); | ||
644 | 174 | if (!device->attr_bag) | ||
645 | 175 | { | ||
646 | 176 | geis_debug("error allocating attr bag"); | ||
647 | 177 | goto unwind_device; | ||
648 | 178 | } | ||
649 | 179 | |||
650 | 180 | device->name = strdup(name); | ||
651 | 181 | if (!device->name) | ||
652 | 182 | { | ||
653 | 183 | geis_debug("error allocating device name"); | ||
654 | 184 | goto unwind_attrs; | ||
655 | 185 | } | ||
656 | 186 | |||
657 | 187 | device->id = id; | ||
658 | 188 | geis_device_ref(device); | ||
659 | 189 | goto final_exit; | ||
660 | 190 | |||
661 | 191 | unwind_attrs: | ||
662 | 192 | geis_attr_bag_delete(device->attr_bag); | ||
663 | 193 | unwind_device: | ||
664 | 194 | free(device); | ||
665 | 195 | device = NULL; | ||
666 | 196 | final_exit: | ||
667 | 197 | return device; | ||
668 | 198 | } | ||
669 | 199 | |||
670 | 200 | |||
671 | 201 | /* | ||
672 | 202 | * Destroys a device. | ||
673 | 203 | */ | ||
674 | 204 | static void | ||
675 | 205 | _device_delete(GeisDevice device) | ||
676 | 206 | { | ||
677 | 207 | free((char *)device->name); | ||
678 | 208 | free(device); | ||
679 | 209 | } | ||
680 | 210 | |||
681 | 211 | |||
682 | 212 | /* | ||
683 | 213 | * Adds a reference count to a device. | ||
684 | 214 | */ | ||
685 | 215 | void | ||
686 | 216 | geis_device_ref(GeisDevice device) | ||
687 | 217 | { | ||
688 | 218 | __sync_add_and_fetch(&device->ref_count, 1); | ||
689 | 219 | } | ||
690 | 220 | |||
691 | 221 | |||
692 | 222 | /* | ||
693 | 223 | * Removes a reference count from a device. | ||
694 | 224 | */ | ||
695 | 225 | void | ||
696 | 226 | geis_device_unref(GeisDevice device) | ||
697 | 227 | { | ||
698 | 228 | if (0 == __sync_sub_and_fetch(&device->ref_count, 1)) | ||
699 | 229 | { | ||
700 | 230 | _device_delete(device); | ||
701 | 231 | } | ||
702 | 232 | } | ||
703 | 233 | |||
704 | 234 | |||
705 | 235 | /* | ||
706 | 236 | * Gets the name of teh input device. | ||
707 | 237 | */ | ||
708 | 238 | GeisString | ||
709 | 239 | geis_device_name(GeisDevice device) | ||
710 | 240 | { | ||
711 | 241 | return device->name; | ||
712 | 242 | } | ||
713 | 243 | |||
714 | 244 | |||
715 | 245 | /* | ||
716 | 246 | * Gets the system identifier of the iput device. | ||
717 | 247 | */ | ||
718 | 248 | GeisInteger | ||
719 | 249 | geis_device_id(GeisDevice device) | ||
720 | 250 | { | ||
721 | 251 | return device->id; | ||
722 | 252 | } | ||
723 | 253 | |||
724 | 254 | |||
725 | 255 | /* | ||
726 | 256 | * Gets the number of attributes of the device. | ||
727 | 257 | */ | ||
728 | 258 | GeisSize | ||
729 | 259 | geis_device_attr_count(GeisDevice device) | ||
730 | 260 | { | ||
731 | 261 | return geis_attr_bag_count(device->attr_bag); | ||
732 | 262 | } | ||
733 | 263 | |||
734 | 264 | |||
735 | 265 | /* | ||
736 | 266 | * Gets the indicated attribute of the device. | ||
737 | 267 | */ | ||
738 | 268 | GeisAttr | ||
739 | 269 | geis_device_attr(GeisDevice device, GeisSize index) | ||
740 | 270 | { | ||
741 | 271 | return geis_attr_bag_attr(device->attr_bag, index); | ||
742 | 272 | } | ||
743 | 273 | |||
744 | 0 | 274 | ||
745 | === added file 'libutouch-geis/geis_device.h' | |||
746 | --- libutouch-geis/geis_device.h 1970-01-01 00:00:00 +0000 | |||
747 | +++ libutouch-geis/geis_device.h 2010-12-21 14:03:26 +0000 | |||
748 | @@ -0,0 +1,104 @@ | |||
749 | 1 | /** | ||
750 | 2 | * @file geis_device.h | ||
751 | 3 | * @brief internal uTouch Geis Input Device module private interface | ||
752 | 4 | * | ||
753 | 5 | * Copyright 2010 Canonical Ltd. | ||
754 | 6 | * | ||
755 | 7 | * This library is free software; you can redistribute it and/or modify it under | ||
756 | 8 | * the terms of the GNU Lesser General Public License as published by the Free | ||
757 | 9 | * Software Foundation; either version 3 of the License, or (at your option) any | ||
758 | 10 | * later version. | ||
759 | 11 | * | ||
760 | 12 | * This library is distributed in the hope that it will be useful, but WITHOUT | ||
761 | 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
762 | 14 | * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more | ||
763 | 15 | * details. | ||
764 | 16 | * | ||
765 | 17 | * You should have received a copy of the GNU Lesser General Public License | ||
766 | 18 | * along with this program; if not, write to the Free Software Foundation, Inc., | ||
767 | 19 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
768 | 20 | */ | ||
769 | 21 | #ifndef GEIS_DEVICE_H_ | ||
770 | 22 | #define GEIS_DEVICE_H_ | ||
771 | 23 | |||
772 | 24 | #include "geis/geis.h" | ||
773 | 25 | |||
774 | 26 | /** | ||
775 | 27 | * @defgroup utouch_geis_device_container A Device Container | ||
776 | 28 | * @{ | ||
777 | 29 | */ | ||
778 | 30 | |||
779 | 31 | /** | ||
780 | 32 | * An unsorted container for holding devices. | ||
781 | 33 | */ | ||
782 | 34 | typedef struct _GeisDeviceBag *GeisDeviceBag; | ||
783 | 35 | |||
784 | 36 | /** | ||
785 | 37 | * Creates a new device bag, | ||
786 | 38 | */ | ||
787 | 39 | GeisDeviceBag geis_device_bag_new(); | ||
788 | 40 | |||
789 | 41 | /** | ||
790 | 42 | * Destroys a device bag. | ||
791 | 43 | * | ||
792 | 44 | * @param[in] bag The device bag, | ||
793 | 45 | */ | ||
794 | 46 | void geis_device_bag_delete(GeisDeviceBag bag); | ||
795 | 47 | |||
796 | 48 | /** | ||
797 | 49 | * Gets the number of devices in the bag. | ||
798 | 50 | * | ||
799 | 51 | * @param[in] bag The device bag, | ||
800 | 52 | */ | ||
801 | 53 | GeisSize geis_device_bag_count(GeisDeviceBag bag); | ||
802 | 54 | |||
803 | 55 | /** | ||
804 | 56 | * Gets an indicated device from a bag. | ||
805 | 57 | * | ||
806 | 58 | * @param[in] bag The device bag. | ||
807 | 59 | * @param[in] index The index. | ||
808 | 60 | */ | ||
809 | 61 | GeisDevice geis_device_bag_device(GeisDeviceBag bag, GeisSize index); | ||
810 | 62 | |||
811 | 63 | /** | ||
812 | 64 | * Inserts a device in teh bag. | ||
813 | 65 | * | ||
814 | 66 | * @param[in] bag The device bag. | ||
815 | 67 | * @param[in] device The device to insert. | ||
816 | 68 | */ | ||
817 | 69 | GeisStatus geis_device_bag_insert(GeisDeviceBag bag, GeisDevice device); | ||
818 | 70 | |||
819 | 71 | /** | ||
820 | 72 | * Remoes a device from the bag. | ||
821 | 73 | * | ||
822 | 74 | * @param[in] bag The device bag. | ||
823 | 75 | * @param[in] device The device to remove. | ||
824 | 76 | */ | ||
825 | 77 | GeisStatus geis_device_bag_remove(GeisDeviceBag bag, GeisDevice device); | ||
826 | 78 | |||
827 | 79 | /** @} */ | ||
828 | 80 | |||
829 | 81 | /** | ||
830 | 82 | * @defgroup utouch_geis_device Internal Device Functions | ||
831 | 83 | * @{ | ||
832 | 84 | */ | ||
833 | 85 | |||
834 | 86 | /** | ||
835 | 87 | * Creates a new device. | ||
836 | 88 | * | ||
837 | 89 | * @param[in] name A system-specific device name. | ||
838 | 90 | * @param[in] id A system-specific device identifier. | ||
839 | 91 | */ | ||
840 | 92 | GeisDevice geis_device_new(GeisString name, GeisInteger id); | ||
841 | 93 | |||
842 | 94 | /** | ||
843 | 95 | * Inserts an attr into a device. | ||
844 | 96 | * | ||
845 | 97 | * @param[in] device A device. | ||
846 | 98 | * @param[in] attr An attr. | ||
847 | 99 | */ | ||
848 | 100 | void geis_device_add_attr(GeisDevice device, GeisAttr attr); | ||
849 | 101 | |||
850 | 102 | /* @} */ | ||
851 | 103 | |||
852 | 104 | #endif /* GEIS_DEVICE_H_ */ | ||
853 | 0 | 105 | ||
854 | === modified file 'libutouch-geis/libutouch-geis.ver' | |||
855 | --- libutouch-geis/libutouch-geis.ver 2010-12-20 18:06:36 +0000 | |||
856 | +++ libutouch-geis/libutouch-geis.ver 2010-12-21 14:03:26 +0000 | |||
857 | @@ -21,6 +21,12 @@ | |||
858 | 21 | geis_attr_value_to_pointer; | 21 | geis_attr_value_to_pointer; |
859 | 22 | geis_attr_value_to_string; | 22 | geis_attr_value_to_string; |
860 | 23 | geis_delete; | 23 | geis_delete; |
861 | 24 | geis_device_attr; | ||
862 | 25 | geis_device_attr_count; | ||
863 | 26 | geis_device_id; | ||
864 | 27 | geis_device_name; | ||
865 | 28 | geis_device_ref; | ||
866 | 29 | geis_device_unref; | ||
867 | 24 | geis_dispatch_events; | 30 | geis_dispatch_events; |
868 | 25 | geis_error_code; | 31 | geis_error_code; |
869 | 26 | geis_error_count; | 32 | geis_error_count; |
870 | @@ -31,6 +37,7 @@ | |||
871 | 31 | geis_region_delete; | 37 | geis_region_delete; |
872 | 32 | geis_region_name; | 38 | geis_region_name; |
873 | 33 | geis_region_new; | 39 | geis_region_new; |
874 | 40 | geis_register_device_callback; | ||
875 | 34 | geis_register_event_callback; | 41 | geis_register_event_callback; |
876 | 35 | geis_set_configuration; | 42 | geis_set_configuration; |
877 | 36 | geis_subscription_activate; | 43 | geis_subscription_activate; |
878 | 37 | 44 | ||
879 | === modified file 'testsuite/geis2/Makefile.am' | |||
880 | --- testsuite/geis2/Makefile.am 2010-12-20 18:06:36 +0000 | |||
881 | +++ testsuite/geis2/Makefile.am 2010-12-21 14:03:26 +0000 | |||
882 | @@ -16,6 +16,7 @@ | |||
883 | 16 | check_geis2_api_SOURCES = \ | 16 | check_geis2_api_SOURCES = \ |
884 | 17 | check_attr.c \ | 17 | check_attr.c \ |
885 | 18 | check_config.c \ | 18 | check_config.c \ |
886 | 19 | check_device.c \ | ||
887 | 19 | check_error_codes.c \ | 20 | check_error_codes.c \ |
888 | 20 | check_event.c \ | 21 | check_event.c \ |
889 | 21 | check_geis_new.c \ | 22 | check_geis_new.c \ |
890 | 22 | 23 | ||
891 | === added file 'testsuite/geis2/check_device.c' | |||
892 | --- testsuite/geis2/check_device.c 1970-01-01 00:00:00 +0000 | |||
893 | +++ testsuite/geis2/check_device.c 2010-12-21 14:03:26 +0000 | |||
894 | @@ -0,0 +1,45 @@ | |||
895 | 1 | /** | ||
896 | 2 | * Unit tests for GEIS v2.0 Input Device Module. | ||
897 | 3 | */ | ||
898 | 4 | #include <check.h> | ||
899 | 5 | |||
900 | 6 | #include <geis/geis.h> | ||
901 | 7 | |||
902 | 8 | /* Compile-time test to ensure types are defined */ | ||
903 | 9 | START_TEST(geis_device_types) | ||
904 | 10 | { | ||
905 | 11 | GeisEventType type; | ||
906 | 12 | } | ||
907 | 13 | END_TEST | ||
908 | 14 | |||
909 | 15 | /* Compile-and-link-time test to verify required functions exist */ | ||
910 | 16 | START_TEST(geis_device_functions) | ||
911 | 17 | { | ||
912 | 18 | Geis geis; | ||
913 | 19 | GeisEventCallback callback; | ||
914 | 20 | GeisDevice device; | ||
915 | 21 | geis_register_device_callback(geis, callback, NULL); | ||
916 | 22 | |||
917 | 23 | geis_device_ref(device); | ||
918 | 24 | geis_device_unref(device); | ||
919 | 25 | GeisString n = geis_device_name(device); | ||
920 | 26 | GeisInteger i = geis_device_id(device); | ||
921 | 27 | GeisSize s = geis_device_attr_count(device); | ||
922 | 28 | GeisAttr a = geis_device_attr(device, 0); | ||
923 | 29 | } | ||
924 | 30 | END_TEST | ||
925 | 31 | |||
926 | 32 | |||
927 | 33 | /* boilerplate */ | ||
928 | 34 | Suite * | ||
929 | 35 | geis2_device_suite_new() | ||
930 | 36 | { | ||
931 | 37 | Suite *s = suite_create("geis2_device"); | ||
932 | 38 | |||
933 | 39 | TCase *device = tcase_create("geis2_device"); | ||
934 | 40 | tcase_add_test(device, geis_device_types); | ||
935 | 41 | suite_add_tcase(s, device); | ||
936 | 42 | |||
937 | 43 | return s; | ||
938 | 44 | } | ||
939 | 45 | |||
940 | 0 | 46 | ||
941 | === modified file 'testsuite/geis2/check_geis2_api.c' | |||
942 | --- testsuite/geis2/check_geis2_api.c 2010-12-20 18:06:36 +0000 | |||
943 | +++ testsuite/geis2/check_geis2_api.c 2010-12-21 14:03:26 +0000 | |||
944 | @@ -7,6 +7,7 @@ | |||
945 | 7 | extern Suite *make_version_macro_suite(); | 7 | extern Suite *make_version_macro_suite(); |
946 | 8 | extern Suite *geis2_general_types_suite_new(); | 8 | extern Suite *geis2_general_types_suite_new(); |
947 | 9 | extern Suite *geis2_error_codes_suite_new(); | 9 | extern Suite *geis2_error_codes_suite_new(); |
948 | 10 | extern Suite *geis2_device_suite_new(); | ||
949 | 10 | extern Suite *geis2_geis_new_suite_new(); | 11 | extern Suite *geis2_geis_new_suite_new(); |
950 | 11 | extern Suite *geis2_config_suite_new(); | 12 | extern Suite *geis2_config_suite_new(); |
951 | 12 | extern Suite *geis2_attr_suite_new(); | 13 | extern Suite *geis2_attr_suite_new(); |
952 | @@ -29,6 +30,7 @@ | |||
953 | 29 | srunner_add_suite(sr, geis2_config_suite_new()); | 30 | srunner_add_suite(sr, geis2_config_suite_new()); |
954 | 30 | srunner_add_suite(sr, geis2_attr_suite_new()); | 31 | srunner_add_suite(sr, geis2_attr_suite_new()); |
955 | 31 | srunner_add_suite(sr, geis2_region_suite_new()); | 32 | srunner_add_suite(sr, geis2_region_suite_new()); |
956 | 33 | srunner_add_suite(sr, geis2_device_suite_new()); | ||
957 | 32 | srunner_add_suite(sr, geis2_subscription_suite_new()); | 34 | srunner_add_suite(sr, geis2_subscription_suite_new()); |
958 | 33 | srunner_add_suite(sr, geis2_event_suite_new()); | 35 | srunner_add_suite(sr, geis2_event_suite_new()); |
959 | 34 | 36 | ||
960 | 35 | 37 | ||
961 | === modified file 'testsuite/libutouch-geis/Makefile.am' | |||
962 | --- testsuite/libutouch-geis/Makefile.am 2010-12-20 18:06:36 +0000 | |||
963 | +++ testsuite/libutouch-geis/Makefile.am 2010-12-21 14:03:26 +0000 | |||
964 | @@ -32,10 +32,11 @@ | |||
965 | 32 | 32 | ||
966 | 33 | check_geis2_internals_SOURCES = \ | 33 | check_geis2_internals_SOURCES = \ |
967 | 34 | check_attr.c \ | 34 | check_attr.c \ |
968 | 35 | check_geis_private.c \ | ||
969 | 36 | check_backend_multiplexor.c \ | 35 | check_backend_multiplexor.c \ |
970 | 36 | check_device.c \ | ||
971 | 37 | check_error_reporting.c \ | 37 | check_error_reporting.c \ |
972 | 38 | check_event_queue.c \ | 38 | check_event_queue.c \ |
973 | 39 | check_geis_private.c \ | ||
974 | 39 | check_region.c \ | 40 | check_region.c \ |
975 | 40 | check_subscription.c \ | 41 | check_subscription.c \ |
976 | 41 | check_geis2_internals.c | 42 | check_geis2_internals.c |
977 | 42 | 43 | ||
978 | === added file 'testsuite/libutouch-geis/check_device.c' | |||
979 | --- testsuite/libutouch-geis/check_device.c 1970-01-01 00:00:00 +0000 | |||
980 | +++ testsuite/libutouch-geis/check_device.c 2010-12-21 14:03:26 +0000 | |||
981 | @@ -0,0 +1,99 @@ | |||
982 | 1 | /** | ||
983 | 2 | * unit tests for the geis device module | ||
984 | 3 | */ | ||
985 | 4 | #include <check.h> | ||
986 | 5 | |||
987 | 6 | #include "libutouch-geis/geis_device.h" | ||
988 | 7 | |||
989 | 8 | |||
990 | 9 | /* fixtures */ | ||
991 | 10 | static GeisDeviceBag g_device_bag; | ||
992 | 11 | static GeisString g_device_name = "device"; | ||
993 | 12 | static GeisInteger g_device_id = 12; | ||
994 | 13 | |||
995 | 14 | /* fixture setup */ | ||
996 | 15 | static void | ||
997 | 16 | construct_bag() | ||
998 | 17 | { | ||
999 | 18 | g_device_bag = geis_device_bag_new(); | ||
1000 | 19 | } | ||
1001 | 20 | |||
1002 | 21 | /* fixture teardown */ | ||
1003 | 22 | static void | ||
1004 | 23 | destroy_bag() | ||
1005 | 24 | { | ||
1006 | 25 | geis_device_bag_delete(g_device_bag); | ||
1007 | 26 | } | ||
1008 | 27 | |||
1009 | 28 | /* verify bag construction/destruction */ | ||
1010 | 29 | START_TEST(construct) | ||
1011 | 30 | { | ||
1012 | 31 | GeisDeviceBag bag = geis_device_bag_new(); | ||
1013 | 32 | fail_unless(bag != NULL, "failed to create device bag"); | ||
1014 | 33 | geis_device_bag_delete(bag); | ||
1015 | 34 | } | ||
1016 | 35 | END_TEST | ||
1017 | 36 | |||
1018 | 37 | /* verify bag insertion */ | ||
1019 | 38 | START_TEST(insert) | ||
1020 | 39 | { | ||
1021 | 40 | GeisDevice device = geis_device_new(g_device_name, g_device_id); | ||
1022 | 41 | geis_device_bag_insert(g_device_bag, device); | ||
1023 | 42 | fail_unless(geis_device_bag_count(g_device_bag) == 1, | ||
1024 | 43 | "unexpected bag size after insertion"); | ||
1025 | 44 | } | ||
1026 | 45 | END_TEST | ||
1027 | 46 | |||
1028 | 47 | /* verify bag removal */ | ||
1029 | 48 | START_TEST(remove) | ||
1030 | 49 | { | ||
1031 | 50 | GeisDevice device = geis_device_new(g_device_name, g_device_id); | ||
1032 | 51 | geis_device_bag_insert(g_device_bag, device); | ||
1033 | 52 | fail_unless(geis_device_bag_count(g_device_bag) == 1, | ||
1034 | 53 | "unexpected bag size after insertion"); | ||
1035 | 54 | geis_device_bag_remove(g_device_bag, device); | ||
1036 | 55 | fail_unless(geis_device_bag_count(g_device_bag) == 0, | ||
1037 | 56 | "unexpected bag size after removal"); | ||
1038 | 57 | } | ||
1039 | 58 | END_TEST | ||
1040 | 59 | |||
1041 | 60 | START_TEST(expand) | ||
1042 | 61 | { | ||
1043 | 62 | int i; | ||
1044 | 63 | for (i = 0; i < 24; ++i) | ||
1045 | 64 | { | ||
1046 | 65 | GeisSize count; | ||
1047 | 66 | char name[32]; | ||
1048 | 67 | sprintf(name, "%04d", i); | ||
1049 | 68 | GeisDevice device = geis_device_new(name, i); | ||
1050 | 69 | geis_device_bag_insert(g_device_bag, device); | ||
1051 | 70 | count = geis_device_bag_count(g_device_bag); | ||
1052 | 71 | fail_unless(count == (i+1), | ||
1053 | 72 | "unexpected bag size %ld after insertion, expected %d", | ||
1054 | 73 | count, i+1); | ||
1055 | 74 | } | ||
1056 | 75 | } | ||
1057 | 76 | END_TEST | ||
1058 | 77 | |||
1059 | 78 | |||
1060 | 79 | |||
1061 | 80 | /* boilerplate */ | ||
1062 | 81 | Suite * | ||
1063 | 82 | make_device_suite() | ||
1064 | 83 | { | ||
1065 | 84 | Suite *s = suite_create("utouch-geis2-device"); | ||
1066 | 85 | |||
1067 | 86 | TCase *create = tcase_create("device-bag-creation"); | ||
1068 | 87 | tcase_add_test(create, construct); | ||
1069 | 88 | suite_add_tcase(s, create); | ||
1070 | 89 | |||
1071 | 90 | TCase *usage = tcase_create("device-bag-usage"); | ||
1072 | 91 | tcase_add_checked_fixture(usage, construct_bag, destroy_bag); | ||
1073 | 92 | tcase_add_test(usage, insert); | ||
1074 | 93 | tcase_add_test(usage, remove); | ||
1075 | 94 | tcase_add_test(usage, expand); | ||
1076 | 95 | suite_add_tcase(s, usage); | ||
1077 | 96 | |||
1078 | 97 | return s; | ||
1079 | 98 | } | ||
1080 | 99 | |||
1081 | 0 | 100 | ||
1082 | === modified file 'testsuite/libutouch-geis/check_geis2_internals.c' | |||
1083 | --- testsuite/libutouch-geis/check_geis2_internals.c 2010-12-17 02:56:43 +0000 | |||
1084 | +++ testsuite/libutouch-geis/check_geis2_internals.c 2010-12-21 14:03:26 +0000 | |||
1085 | @@ -8,6 +8,7 @@ | |||
1086 | 8 | extern Suite *make_attr_suite(); | 8 | extern Suite *make_attr_suite(); |
1087 | 9 | extern Suite *make_backend_event_posting_suite(); | 9 | extern Suite *make_backend_event_posting_suite(); |
1088 | 10 | extern Suite *make_backend_multiplexor_suite(); | 10 | extern Suite *make_backend_multiplexor_suite(); |
1089 | 11 | extern Suite *make_device_suite(); | ||
1090 | 11 | extern Suite *make_error_reporting_suite(); | 12 | extern Suite *make_error_reporting_suite(); |
1091 | 12 | extern Suite *make_event_queue_suite(); | 13 | extern Suite *make_event_queue_suite(); |
1092 | 13 | extern Suite *make_region_suite(); | 14 | extern Suite *make_region_suite(); |
1093 | @@ -27,6 +28,7 @@ | |||
1094 | 27 | srunner_add_suite(sr, make_event_queue_suite()); | 28 | srunner_add_suite(sr, make_event_queue_suite()); |
1095 | 28 | srunner_add_suite(sr, make_backend_multiplexor_suite()); | 29 | srunner_add_suite(sr, make_backend_multiplexor_suite()); |
1096 | 29 | srunner_add_suite(sr, make_backend_event_posting_suite()); | 30 | srunner_add_suite(sr, make_backend_event_posting_suite()); |
1097 | 31 | srunner_add_suite(sr, make_device_suite()); | ||
1098 | 30 | srunner_add_suite(sr, make_region_suite()); | 32 | srunner_add_suite(sr, make_region_suite()); |
1099 | 31 | srunner_add_suite(sr, make_subscription_suite()); | 33 | srunner_add_suite(sr, make_subscription_suite()); |
1100 | 32 | 34 |
Are the region defines untouched in this branch? It seems like it from the logs, but there is quite a bit of diff touching the region header.