Merge lp:~bregma/geis/packaging-1.0.11 into lp:~oif-team/geis/packaging

Proposed by Stephen M. Webb
Status: Merged
Merged at revision: 84
Proposed branch: lp:~bregma/geis/packaging-1.0.11
Merge into: lp:~oif-team/geis/packaging
Diff against target: 2812 lines (+1641/-391)
24 files modified
ChangeLog (+169/-0)
Makefile.in (+4/-0)
configure (+177/-25)
configure.ac (+6/-1)
debian/changelog (+6/-2)
doc/Makefile.in (+4/-0)
doc/geistest.1 (+23/-5)
geis/Makefile.in (+4/-0)
geis/geis.h (+24/-2)
libutouch-geis-xcb/Makefile.am (+11/-6)
libutouch-geis-xcb/Makefile.in (+44/-16)
libutouch-geis-xcb/geis.c (+16/-5)
libutouch-geis-xcb/geis_debug.h (+0/-27)
libutouch-geis-xcb/geis_instance.c (+44/-24)
libutouch-geis-xcb/geis_instance.h (+7/-11)
libutouch-geis-xcb/geis_instance_table.c (+127/-0)
libutouch-geis-xcb/geis_instance_table.h (+41/-0)
libutouch-geis-xcb/geis_logging.c (+87/-0)
libutouch-geis-xcb/geis_logging.h (+64/-0)
libutouch-geis-xcb/geis_xcb.c (+530/-215)
libutouch-geis-xcb/geis_xcb.h (+25/-17)
testsuite/Makefile.in (+4/-0)
testsuite/geistest/Makefile.in (+4/-0)
testsuite/geistest/geistest.c (+220/-35)
To merge this branch: bzr merge lp:~bregma/geis/packaging-1.0.11
Reviewer Review Type Date Requested Status
Henrik Rydberg (community) Approve
Review via email: mp+35685@code.launchpad.net

Commit message

Packging utouch-geis release 1.0.11

Description of the change

Packages utouch-geis 1.0.11 for Ubuntu

This merge request supersedes the previous similar merge requires because a step was missed during upstream source merging.

To post a comment you must log in.
Revision history for this message
Henrik Rydberg (rydberg) wrote :

Look ok now. :-)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog'
2--- ChangeLog 2010-08-23 14:34:23 +0000
3+++ ChangeLog 2010-09-16 16:28:52 +0000
4@@ -1,3 +1,172 @@
5+2010-09-14 Stephen M. Webb <stephen.webb@canonical.com>
6+
7+ Version bump tp 1.0.11
8+
9+ * configure.ac: bumped package version to 1.0.11
10+ * libutouch-geis-xcb/Makefile.am: bumped shlib version to reflect changes
11+
12+2010-09-01 Stephen M. Webb <stephen.webb@canonical.com>
13+
14+ Fixed typos in manpage.
15+
16+ * doc/geistest.1: fixed several typographical errors
17+
18+2010-09-01 Stephen M. Webb <stephen.webb@canonical.com>
19+
20+ Fixed a memory leak when logging messages.
21+
22+ * libutouch-geis-xcb/geis_logging.c (_geis_message): fixed memory leak
23+
24+2010-08-31 Stephen M. Webb <stephen.webb@canonical.com>
25+
26+ Fixed prefix string used in diagnostics.
27+
28+ * libutouch-geis-xcb/geis_logging.c (_geis_message): fixed which prefix string
29+ gets used for which diagnostic level
30+
31+2010-08-31 Stephen M. Webb <stephen.webb@canonical.com>
32+
33+ Removed input device enumeration handling until later.
34+
35+ * libutouch-geis-xcb/geis.c (geis_input_devices): removed #if 0 block
36+ * libutouch-geis-xcb/geis_instance.h (geis_instance_input_devices): removed
37+ * libutouch-geis-xcb/geis_instance.c (geis_instance_input_devices): removed
38+ * libutouch-geis-xcb/geis_xcb.h (geis_xcb_input_devices): added funcs and
39+ cookie parameters
40+ * libutouch-geis-xcb/geis_xcb.c (_GeisXcb): added input_funcs and input_cookie
41+ (geis_xcb_new): removed #if 0 blocks
42+ (geis_xcb_input_devices): removed XInput handling until later
43+
44+2010-08-30 Stephen M. Webb <stephen.webb@canonical.com>
45+
46+ Removed some debug code and fixed pasto.
47+
48+ * libutouch-geis-xcb/geis_instance.c: fixed a pasto
49+ * testsuite/geistest/geistest.c: removed debug code
50+
51+2010-08-30 Stephen M. Webb <stephen.webb@canonical.com>
52+
53+ Fixed so multiple windows will work.
54+
55+ Altered geistest to work with a single window or all windows, had to fix geis
56+ implementation so this was possible.
57+
58+ * libutouch-geis-xcb/geis_instance_table.c: new file
59+ * libutouch-geis-xcb/geis_instance_table.h: new file
60+ * configure.ac: added package checks for x11-xcb and xi
61+ * doc/geistest.1: documented new CLI switches
62+ * geis/geis.h (geis_input_devices): fixed argument type
63+ * libutouch-geis-xcb/Makefile.am (libutouch_geis_la_SOURCES): added new files
64+ (libutouch_geis_la_CFLAGS): aded X11XCB_CFLAGS and XI2_CFLAGS
65+ (libutouch_geis_la_LIBADD): aded X11XCB_LIBS and XI2LIBS_
66+ * libutouch-geis-xcb/geis.c (s_geis_xcb): new static global
67+ (geis_init): used it
68+ * libutouch-geis-xcb/geis_instance.h (_GeisInstance): added window_id
69+ (geis_instance_new): renamed from geis_instance_get
70+ (geis_instance_input_devices): new function
71+ (geis_instance_subscribe): added GeisXcb parameter
72+ (geis_instance_get_window_id): new function
73+ (geis_instance_fd): removed function
74+ (geis_instance_event_dispatch): removed function
75+ * libutouch-geis-xcb/geis_instance.c: implemented new functions
76+ * libutouch-geis-xcb/geis_xcb.h (geis_xcb_new): renamed from geis_xcb_get
77+ (geis_xcb_create_instance): new function
78+ (geis_xcb_input_devices): new function
79+ (geis_xcb_subscribe): added GeisInstance parameter
80+ (geis_xcb_dispatch): changed parameter type to GeisXcb
81+ * libutouch-geis-xcb/geis_xcb.c: Implemeneted new functions
82+ * testsuite/geistest/geistest.c (parse_opts): added -w switch
83+ (subscribe_window): new function
84+ (subscribe_windows_preorder): new function
85+ (subscribe_all_windows): new function
86+ (main): used the new functions
87+
88+2010-08-30 Stephen M. Webb <stephen.webb@canonical.com>
89+
90+ Added runtime diagnostic facility.
91+
92+ * libutouch-geis-xcb/geis_debug.h: replaced with
93+ * libutouch-geis-xcb/geis_logging.h: mew file
94+ * libutouch-geis-xcb/geis_logging.c: new file
95+ * libutouch-geis-xcb/Makefile.am: replaced above files
96+ * libutouch-geis-xcb/geis_xcb.c: replaced geis_debug calls with
97+ geis_warning or geis_error as appropriate
98+
99+2010-08-27 Stephen M. Webb <stephen.webb@canonical.com>
100+
101+ Fixed checking of gesture masks for multiple input devices.
102+
103+ * libutouch-geis-xcb/geis_instance.c (geis_instance_subscribe):
104+ added missing index increment
105+ * libutouch-geis-xcb/geis_xcb.c (geis_xcb_verify_event_selection):
106+ added logic for iterating through multiple input devices
107+
108+2010-08-27 Stephen M. Webb <stephen.webb@canonical.com>
109+
110+ Move gesture-type-added callback until later in the subscription sequence.
111+
112+ * libutouch-geis-xcb/geis_xcb.c (geis_xcb_subscribe): move call to
113+ geis_xcb_dispatch_gesture_type until later in sequence
114+
115+2010-08-27 Stephen M. Webb <stephen.webb@canonical.com>
116+
117+ Removed "Grab" gestire entirely from the list of known gestures.
118+
119+ * libutouch-geis-xcb/geis_xcb.c (s_grail_type_map): removed GRAIL_TYPE_SYSFLAG1
120+ (geis_xcb_dispatch_gesture_type): removed references to GRAIL_TYPE_SYSFLAG1
121+
122+2010-08-26 Stephen M. Webb <stephen.webb@canonical.com>
123+
124+ Prevented "Grab" gesture from being propagated.
125+
126+ * libutouch-geis-xcb/geis_xcb.c (geis_xcb_dispatch_gesture_type): skipped
127+ notification of the availability of the "Grab" gesture type.
128+
129+2010-08-26 Stephen M. Webb <stephen.webb@canonical.com>
130+
131+ Fixed an allocation size issue.
132+
133+ * libutouch-geis-xcb/geis_instance.c (geis_instance_get): fixed allocation
134+ size issue
135+
136+2010-08-26 Stephen M. Webb <stephen.webb@canonical.com>
137+
138+ Minor style adjustments. Adjusted whitespace for consistency.
139+
140+ * libutouch-geis-xcb/geis_xcb.c (geis_xcb_verify_event_selection):
141+ renamed function from geis_xcb_select_events
142+ (geis_xcb_determine_primitive_type): renamed from
143+ geis_xcb_determine_fundamental_gesture_type
144+ (geis_xcb_get_gesture_type_primitive_name): renamed form
145+ geis_xcb_get_gesture_type_fundamental_name
146+
147+2010-08-25 Stephen M. Webb <stephen.webb@canonical.com>
148+
149+ Reverted version bump.
150+
151+ * configure,.ac (AC_INIT): reverted to version 1.0.10
152+
153+2010-08-23 Stephen M. Webb <stephen.webb@canonical.com>
154+
155+ Implemented gesture and input device selection.
156+
157+ * geis/geis.h: new gesture definitions
158+ * libutouch-geis-xcb/geis_xcb.h (geis_xcb_subscribe):
159+ added device_id parameter
160+ * libutouch-geis-xcb/geis_xcb.c (s_grail_type_map): new gesture definitions
161+ (geis_xcb_map_gestures_to_mask): new function
162+ (geis_xcb_select_events): new function
163+ (geis_xcb_subscribe): used them
164+ added device_id parameter
165+ (geis_xcb_determine_gesture_type): renamed to
166+ geis_xcb_determine_fundamental_gesture_type
167+ (geis_xcb_get_gesture_type_fundamental_name): new function
168+ (geis_xcb_dispatch_gesture_type): mapped public gesture definitions to
169+ fundamental gesture types
170+ * libutouch-geis-xcb/geis_instance.c (geis_instance_subscribe):
171+ handled input_list argument
172+ * testsuite/geistest/geistest.c: included an example of selecting gestures
173+
174 2010-08-22 Chase Douglas <chase.douglas@canonical.com>
175
176 Bumped to version 1.0.10 for various fixes
177
178=== modified file 'Makefile.in'
179--- Makefile.in 2010-08-20 22:03:52 +0000
180+++ Makefile.in 2010-09-16 16:28:52 +0000
181@@ -205,11 +205,15 @@
182 SHELL = @SHELL@
183 STRIP = @STRIP@
184 VERSION = @VERSION@
185+X11XCB_CFLAGS = @X11XCB_CFLAGS@
186+X11XCB_LIBS = @X11XCB_LIBS@
187 XCBINCLUDEDIR = @XCBINCLUDEDIR@
188 XCBPROTO_XCBINCLUDEDIR = @XCBPROTO_XCBINCLUDEDIR@
189 XCBPROTO_XCBPYTHONDIR = @XCBPROTO_XCBPYTHONDIR@
190 XCB_CFLAGS = @XCB_CFLAGS@
191 XCB_LIBS = @XCB_LIBS@
192+XI2_CFLAGS = @XI2_CFLAGS@
193+XI2_LIBS = @XI2_LIBS@
194 abs_builddir = @abs_builddir@
195 abs_srcdir = @abs_srcdir@
196 abs_top_builddir = @abs_top_builddir@
197
198=== modified file 'configure'
199--- configure 2010-08-23 14:54:15 +0000
200+++ configure 2010-09-16 16:28:52 +0000
201@@ -1,6 +1,6 @@
202 #! /bin/sh
203 # Guess values for system-dependent variables and create Makefiles.
204-# Generated by GNU Autoconf 2.67 for utouch-geis 1.0.10.
205+# Generated by GNU Autoconf 2.67 for utouch-geis 1.0.11.
206 #
207 # Report bugs to <stephen.webb@canonical.com>.
208 #
209@@ -701,8 +701,8 @@
210 # Identity of this package.
211 PACKAGE_NAME='utouch-geis'
212 PACKAGE_TARNAME='utouch-geis'
213-PACKAGE_VERSION='1.0.10'
214-PACKAGE_STRING='utouch-geis 1.0.10'
215+PACKAGE_VERSION='1.0.11'
216+PACKAGE_STRING='utouch-geis 1.0.11'
217 PACKAGE_BUGREPORT='stephen.webb@canonical.com'
218 PACKAGE_URL='https://launchpad.net/utouch-geis'
219
220@@ -749,6 +749,10 @@
221 XCBINCLUDEDIR
222 XCBPROTO_XCBPYTHONDIR
223 XCBPROTO_XCBINCLUDEDIR
224+XI2_LIBS
225+XI2_CFLAGS
226+X11XCB_LIBS
227+X11XCB_CFLAGS
228 XCB_LIBS
229 XCB_CFLAGS
230 GRAIL_LIBS
231@@ -896,7 +900,11 @@
232 GRAIL_CFLAGS
233 GRAIL_LIBS
234 XCB_CFLAGS
235-XCB_LIBS'
236+XCB_LIBS
237+X11XCB_CFLAGS
238+X11XCB_LIBS
239+XI2_CFLAGS
240+XI2_LIBS'
241
242
243 # Initialize some variables set by options.
244@@ -1439,7 +1447,7 @@
245 # Omit some internal or obsolete options to make the list less imposing.
246 # This message is too long to be a string in the A/UX 3.1 sh.
247 cat <<_ACEOF
248-\`configure' configures utouch-geis 1.0.10 to adapt to many kinds of systems.
249+\`configure' configures utouch-geis 1.0.11 to adapt to many kinds of systems.
250
251 Usage: $0 [OPTION]... [VAR=VALUE]...
252
253@@ -1509,7 +1517,7 @@
254
255 if test -n "$ac_init_help"; then
256 case $ac_init_help in
257- short | recursive ) echo "Configuration of utouch-geis 1.0.10:";;
258+ short | recursive ) echo "Configuration of utouch-geis 1.0.11:";;
259 esac
260 cat <<\_ACEOF
261
262@@ -1551,6 +1559,11 @@
263 GRAIL_LIBS linker flags for GRAIL, overriding pkg-config
264 XCB_CFLAGS C compiler flags for XCB, overriding pkg-config
265 XCB_LIBS linker flags for XCB, overriding pkg-config
266+ X11XCB_CFLAGS
267+ C compiler flags for X11XCB, overriding pkg-config
268+ X11XCB_LIBS linker flags for X11XCB, overriding pkg-config
269+ XI2_CFLAGS C compiler flags for XI2, overriding pkg-config
270+ XI2_LIBS linker flags for XI2, overriding pkg-config
271
272 Use these variables to override the choices made by `configure' or to help
273 it to find libraries and programs with nonstandard names/locations.
274@@ -1619,7 +1632,7 @@
275 test -n "$ac_init_help" && exit $ac_status
276 if $ac_init_version; then
277 cat <<\_ACEOF
278-utouch-geis configure 1.0.10
279+utouch-geis configure 1.0.11
280 generated by GNU Autoconf 2.67
281
282 Copyright (C) 2010 Free Software Foundation, Inc.
283@@ -1897,7 +1910,7 @@
284 This file contains any messages produced by compilers while
285 running configure, to aid debugging if configure makes a mistake.
286
287-It was created by utouch-geis $as_me 1.0.10, which was
288+It was created by utouch-geis $as_me 1.0.11, which was
289 generated by GNU Autoconf 2.67. Invocation command line was
290
291 $ $0 $@
292@@ -2715,7 +2728,7 @@
293
294 # Define the identity of the package.
295 PACKAGE='utouch-geis'
296- VERSION='1.0.10'
297+ VERSION='1.0.11'
298
299
300 cat >>confdefs.h <<_ACEOF
301@@ -4770,13 +4783,13 @@
302 else
303 lt_cv_nm_interface="BSD nm"
304 echo "int some_variable = 0;" > conftest.$ac_ext
305- (eval echo "\"\$as_me:4773: $ac_compile\"" >&5)
306+ (eval echo "\"\$as_me:4786: $ac_compile\"" >&5)
307 (eval "$ac_compile" 2>conftest.err)
308 cat conftest.err >&5
309- (eval echo "\"\$as_me:4776: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
310+ (eval echo "\"\$as_me:4789: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
311 (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
312 cat conftest.err >&5
313- (eval echo "\"\$as_me:4779: output\"" >&5)
314+ (eval echo "\"\$as_me:4792: output\"" >&5)
315 cat conftest.out >&5
316 if $GREP 'External.*some_variable' conftest.out > /dev/null; then
317 lt_cv_nm_interface="MS dumpbin"
318@@ -5982,7 +5995,7 @@
319 ;;
320 *-*-irix6*)
321 # Find out which ABI we are using.
322- echo '#line 5985 "configure"' > conftest.$ac_ext
323+ echo '#line 5998 "configure"' > conftest.$ac_ext
324 if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
325 (eval $ac_compile) 2>&5
326 ac_status=$?
327@@ -7511,11 +7524,11 @@
328 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
329 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
330 -e 's:$: $lt_compiler_flag:'`
331- (eval echo "\"\$as_me:7514: $lt_compile\"" >&5)
332+ (eval echo "\"\$as_me:7527: $lt_compile\"" >&5)
333 (eval "$lt_compile" 2>conftest.err)
334 ac_status=$?
335 cat conftest.err >&5
336- echo "$as_me:7518: \$? = $ac_status" >&5
337+ echo "$as_me:7531: \$? = $ac_status" >&5
338 if (exit $ac_status) && test -s "$ac_outfile"; then
339 # The compiler can only warn and ignore the option if not recognized
340 # So say no if there are warnings other than the usual output.
341@@ -7850,11 +7863,11 @@
342 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
343 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
344 -e 's:$: $lt_compiler_flag:'`
345- (eval echo "\"\$as_me:7853: $lt_compile\"" >&5)
346+ (eval echo "\"\$as_me:7866: $lt_compile\"" >&5)
347 (eval "$lt_compile" 2>conftest.err)
348 ac_status=$?
349 cat conftest.err >&5
350- echo "$as_me:7857: \$? = $ac_status" >&5
351+ echo "$as_me:7870: \$? = $ac_status" >&5
352 if (exit $ac_status) && test -s "$ac_outfile"; then
353 # The compiler can only warn and ignore the option if not recognized
354 # So say no if there are warnings other than the usual output.
355@@ -7955,11 +7968,11 @@
356 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
357 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
358 -e 's:$: $lt_compiler_flag:'`
359- (eval echo "\"\$as_me:7958: $lt_compile\"" >&5)
360+ (eval echo "\"\$as_me:7971: $lt_compile\"" >&5)
361 (eval "$lt_compile" 2>out/conftest.err)
362 ac_status=$?
363 cat out/conftest.err >&5
364- echo "$as_me:7962: \$? = $ac_status" >&5
365+ echo "$as_me:7975: \$? = $ac_status" >&5
366 if (exit $ac_status) && test -s out/conftest2.$ac_objext
367 then
368 # The compiler can only warn and ignore the option if not recognized
369@@ -8010,11 +8023,11 @@
370 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
371 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
372 -e 's:$: $lt_compiler_flag:'`
373- (eval echo "\"\$as_me:8013: $lt_compile\"" >&5)
374+ (eval echo "\"\$as_me:8026: $lt_compile\"" >&5)
375 (eval "$lt_compile" 2>out/conftest.err)
376 ac_status=$?
377 cat out/conftest.err >&5
378- echo "$as_me:8017: \$? = $ac_status" >&5
379+ echo "$as_me:8030: \$? = $ac_status" >&5
380 if (exit $ac_status) && test -s out/conftest2.$ac_objext
381 then
382 # The compiler can only warn and ignore the option if not recognized
383@@ -10394,7 +10407,7 @@
384 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
385 lt_status=$lt_dlunknown
386 cat > conftest.$ac_ext <<_LT_EOF
387-#line 10397 "configure"
388+#line 10410 "configure"
389 #include "confdefs.h"
390
391 #if HAVE_DLFCN_H
392@@ -10490,7 +10503,7 @@
393 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
394 lt_status=$lt_dlunknown
395 cat > conftest.$ac_ext <<_LT_EOF
396-#line 10493 "configure"
397+#line 10506 "configure"
398 #include "confdefs.h"
399
400 #if HAVE_DLFCN_H
401@@ -10978,6 +10991,145 @@
402 $as_echo "yes" >&6; }
403
404 fi
405+
406+pkg_failed=no
407+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for X11XCB" >&5
408+$as_echo_n "checking for X11XCB... " >&6; }
409+
410+if test -n "$X11XCB_CFLAGS"; then
411+ pkg_cv_X11XCB_CFLAGS="$X11XCB_CFLAGS"
412+ elif test -n "$PKG_CONFIG"; then
413+ if test -n "$PKG_CONFIG" && \
414+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"x11-xcb >= 1.3.3\""; } >&5
415+ ($PKG_CONFIG --exists --print-errors "x11-xcb >= 1.3.3") 2>&5
416+ ac_status=$?
417+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
418+ test $ac_status = 0; }; then
419+ pkg_cv_X11XCB_CFLAGS=`$PKG_CONFIG --cflags "x11-xcb >= 1.3.3" 2>/dev/null`
420+else
421+ pkg_failed=yes
422+fi
423+ else
424+ pkg_failed=untried
425+fi
426+if test -n "$X11XCB_LIBS"; then
427+ pkg_cv_X11XCB_LIBS="$X11XCB_LIBS"
428+ elif test -n "$PKG_CONFIG"; then
429+ if test -n "$PKG_CONFIG" && \
430+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"x11-xcb >= 1.3.3\""; } >&5
431+ ($PKG_CONFIG --exists --print-errors "x11-xcb >= 1.3.3") 2>&5
432+ ac_status=$?
433+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
434+ test $ac_status = 0; }; then
435+ pkg_cv_X11XCB_LIBS=`$PKG_CONFIG --libs "x11-xcb >= 1.3.3" 2>/dev/null`
436+else
437+ pkg_failed=yes
438+fi
439+ else
440+ pkg_failed=untried
441+fi
442+
443+
444+
445+if test $pkg_failed = yes; then
446+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
447+$as_echo "no" >&6; }
448+
449+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
450+ _pkg_short_errors_supported=yes
451+else
452+ _pkg_short_errors_supported=no
453+fi
454+ if test $_pkg_short_errors_supported = yes; then
455+ X11XCB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "x11-xcb >= 1.3.3" 2>&1`
456+ else
457+ X11XCB_PKG_ERRORS=`$PKG_CONFIG --print-errors "x11-xcb >= 1.3.3" 2>&1`
458+ fi
459+ # Put the nasty error message in config.log where it belongs
460+ echo "$X11XCB_PKG_ERRORS" >&5
461+
462+ as_fn_error $? "X11-XCB development libraries not found" "$LINENO" 5
463+elif test $pkg_failed = untried; then
464+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
465+$as_echo "no" >&6; }
466+ as_fn_error $? "X11-XCB development libraries not found" "$LINENO" 5
467+else
468+ X11XCB_CFLAGS=$pkg_cv_X11XCB_CFLAGS
469+ X11XCB_LIBS=$pkg_cv_X11XCB_LIBS
470+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
471+$as_echo "yes" >&6; }
472+
473+fi
474+
475+pkg_failed=no
476+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XI2" >&5
477+$as_echo_n "checking for XI2... " >&6; }
478+
479+if test -n "$XI2_CFLAGS"; then
480+ pkg_cv_XI2_CFLAGS="$XI2_CFLAGS"
481+ elif test -n "$PKG_CONFIG"; then
482+ if test -n "$PKG_CONFIG" && \
483+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xi >= 1.3\""; } >&5
484+ ($PKG_CONFIG --exists --print-errors "xi >= 1.3") 2>&5
485+ ac_status=$?
486+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
487+ test $ac_status = 0; }; then
488+ pkg_cv_XI2_CFLAGS=`$PKG_CONFIG --cflags "xi >= 1.3" 2>/dev/null`
489+else
490+ pkg_failed=yes
491+fi
492+ else
493+ pkg_failed=untried
494+fi
495+if test -n "$XI2_LIBS"; then
496+ pkg_cv_XI2_LIBS="$XI2_LIBS"
497+ elif test -n "$PKG_CONFIG"; then
498+ if test -n "$PKG_CONFIG" && \
499+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xi >= 1.3\""; } >&5
500+ ($PKG_CONFIG --exists --print-errors "xi >= 1.3") 2>&5
501+ ac_status=$?
502+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
503+ test $ac_status = 0; }; then
504+ pkg_cv_XI2_LIBS=`$PKG_CONFIG --libs "xi >= 1.3" 2>/dev/null`
505+else
506+ pkg_failed=yes
507+fi
508+ else
509+ pkg_failed=untried
510+fi
511+
512+
513+
514+if test $pkg_failed = yes; then
515+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
516+$as_echo "no" >&6; }
517+
518+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
519+ _pkg_short_errors_supported=yes
520+else
521+ _pkg_short_errors_supported=no
522+fi
523+ if test $_pkg_short_errors_supported = yes; then
524+ XI2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "xi >= 1.3" 2>&1`
525+ else
526+ XI2_PKG_ERRORS=`$PKG_CONFIG --print-errors "xi >= 1.3" 2>&1`
527+ fi
528+ # Put the nasty error message in config.log where it belongs
529+ echo "$XI2_PKG_ERRORS" >&5
530+
531+ as_fn_error $? "XI2 development libraries not found" "$LINENO" 5
532+elif test $pkg_failed = untried; then
533+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
534+$as_echo "no" >&6; }
535+ as_fn_error $? "XI2 development libraries not found" "$LINENO" 5
536+else
537+ XI2_CFLAGS=$pkg_cv_XI2_CFLAGS
538+ XI2_LIBS=$pkg_cv_XI2_LIBS
539+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
540+$as_echo "yes" >&6; }
541+
542+fi
543+
544 # XCB code generation configuration
545 { $as_echo "$as_me:${as_lineno-$LINENO}: checking XCBPROTO_XCBINCLUDEDIR" >&5
546 $as_echo_n "checking XCBPROTO_XCBINCLUDEDIR... " >&6; }
547@@ -11552,7 +11704,7 @@
548 # report actual input values of CONFIG_FILES etc. instead of their
549 # values after options handling.
550 ac_log="
551-This file was extended by utouch-geis $as_me 1.0.10, which was
552+This file was extended by utouch-geis $as_me 1.0.11, which was
553 generated by GNU Autoconf 2.67. Invocation command line was
554
555 CONFIG_FILES = $CONFIG_FILES
556@@ -11619,7 +11771,7 @@
557 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
558 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
559 ac_cs_version="\\
560-utouch-geis config.status 1.0.10
561+utouch-geis config.status 1.0.11
562 configured by $0, generated by GNU Autoconf 2.67,
563 with options \\"\$ac_cs_config\\"
564
565
566=== modified file 'configure.ac'
567--- configure.ac 2010-08-23 14:54:15 +0000
568+++ configure.ac 2010-09-16 16:28:52 +0000
569@@ -2,7 +2,7 @@
570 # Process this file with autoconf to produce a configure script.
571
572 AC_PREREQ(2.65)
573-AC_INIT([utouch-geis],[1.0.10],
574+AC_INIT([utouch-geis],[1.0.11],
575 [stephen.webb@canonical.com],,
576 [https://launchpad.net/utouch-geis])
577 AC_CONFIG_HEADERS([geis_config.h])
578@@ -24,6 +24,11 @@
579 AC_MSG_ERROR([Grail development libraries not found]))
580 PKG_CHECK_MODULES([XCB], [xcb >= 1.6], ,
581 AC_MSG_ERROR([XCB development libraries not found]))
582+PKG_CHECK_MODULES([X11XCB], [x11-xcb >= 1.3.3], ,
583+ AC_MSG_ERROR([X11-XCB development libraries not found]))
584+PKG_CHECK_MODULES([XI2], [xi >= 1.3], ,
585+ AC_MSG_ERROR([XI2 development libraries not found]))
586+
587 # XCB code generation configuration
588 AC_MSG_CHECKING(XCBPROTO_XCBINCLUDEDIR)
589 XCBPROTO_XCBINCLUDEDIR=`$PKG_CONFIG --variable=xcbincludedir xcb-proto`
590
591=== modified file 'debian/changelog'
592--- debian/changelog 2010-08-25 15:34:20 +0000
593+++ debian/changelog 2010-09-16 16:28:52 +0000
594@@ -1,8 +1,12 @@
595-utouch-geis (1.0.10-0ubuntu2) UNRELEASED; urgency=low
596+utouch-geis (1.0.11-0ubuntu1) maverick; urgency=low
597
598+ [ Ara Pulido ]
599 * Added apport hook for utouch-geis (LP: #622817)
600
601- -- Ara Pulido <ara@ubuntu.com> Wed, 25 Aug 2010 15:47:49 +0200
602+ [ Stephen M. Webb ]
603+ * New upstream release (LP: #640530)
604+
605+ -- Stephen M. Webb <stephen.webb@canonical.com> Thu, 16 Sep 2010 12:10:13 -0400
606
607 utouch-geis (1.0.10-0ubuntu1) maverick; urgency=low
608
609
610=== modified file 'doc/Makefile.in'
611--- doc/Makefile.in 2010-08-20 22:03:52 +0000
612+++ doc/Makefile.in 2010-09-16 16:28:52 +0000
613@@ -146,11 +146,15 @@
614 SHELL = @SHELL@
615 STRIP = @STRIP@
616 VERSION = @VERSION@
617+X11XCB_CFLAGS = @X11XCB_CFLAGS@
618+X11XCB_LIBS = @X11XCB_LIBS@
619 XCBINCLUDEDIR = @XCBINCLUDEDIR@
620 XCBPROTO_XCBINCLUDEDIR = @XCBPROTO_XCBINCLUDEDIR@
621 XCBPROTO_XCBPYTHONDIR = @XCBPROTO_XCBPYTHONDIR@
622 XCB_CFLAGS = @XCB_CFLAGS@
623 XCB_LIBS = @XCB_LIBS@
624+XI2_CFLAGS = @XI2_CFLAGS@
625+XI2_LIBS = @XI2_LIBS@
626 abs_builddir = @abs_builddir@
627 abs_srcdir = @abs_srcdir@
628 abs_top_builddir = @abs_top_builddir@
629
630=== modified file 'doc/geistest.1'
631--- doc/geistest.1 2010-08-16 16:25:17 +0000
632+++ doc/geistest.1 2010-09-16 16:28:52 +0000
633@@ -1,10 +1,13 @@
634 .TH geistest 1 "August 16, 2010" "" "geistest"
635
636 .SH NAME
637-geistest \- test operatoin of the GEIS API
638+geistest \- test operation of the GEIS API
639
640 .SH SYNOPSIS
641-.B geistest windowid
642+.B geistest [
643+.B -w
644+.I windowid
645+.B ]
646 .br
647
648 .SH DESCRIPTION
649@@ -12,8 +15,23 @@
650 .B geistest
651 program. This program is a test driver for verifying the recognition and propagation of gestures through the GEIS API.
652
653-
654-.SH EXAMPLE
655+.SH OPTIONS
656+.IP -w
657+Specifies the
658+.I windowId
659+of a specific window to associate with gestures.
660+Particularly useful with touchscreens.
661+
662+The
663+.I windowId
664+can be determined using the program
665+.BR xwininfo .
666+
667+If this argument is not set, the default action is to read gestures on all windows.
668+
669+.SH ENVIRONMENT
670+.IP GEIS_DEBUG
671+Enables GEIS library diagnostic messages on stderr.
672
673 .SH "SEE ALSO"
674-gesturetest(1)
675\ No newline at end of file
676+gesturetest(1)
677
678=== modified file 'geis/Makefile.in'
679--- geis/Makefile.in 2010-08-20 22:03:52 +0000
680+++ geis/Makefile.in 2010-09-16 16:28:52 +0000
681@@ -145,11 +145,15 @@
682 SHELL = @SHELL@
683 STRIP = @STRIP@
684 VERSION = @VERSION@
685+X11XCB_CFLAGS = @X11XCB_CFLAGS@
686+X11XCB_LIBS = @X11XCB_LIBS@
687 XCBINCLUDEDIR = @XCBINCLUDEDIR@
688 XCBPROTO_XCBINCLUDEDIR = @XCBPROTO_XCBINCLUDEDIR@
689 XCBPROTO_XCBPYTHONDIR = @XCBPROTO_XCBPYTHONDIR@
690 XCB_CFLAGS = @XCB_CFLAGS@
691 XCB_LIBS = @XCB_LIBS@
692+XI2_CFLAGS = @XI2_CFLAGS@
693+XI2_LIBS = @XI2_LIBS@
694 abs_builddir = @abs_builddir@
695 abs_srcdir = @abs_srcdir@
696 abs_top_builddir = @abs_top_builddir@
697
698=== modified file 'geis/geis.h'
699--- geis/geis.h 2010-08-23 14:54:18 +0000
700+++ geis/geis.h 2010-09-16 16:28:52 +0000
701@@ -30,6 +30,28 @@
702 #define GEIS_GESTURE_ROTATE "Rotate"
703 #define GEIS_GESTURE_TAP "Tap"
704
705+/* Gesture names for the Simplified Interface */
706+#define GEIS_GESTURE_TYPE_DRAG1 "Drag,touch=1"
707+#define GEIS_GESTURE_TYPE_DRAG2 "Drag,touch=2"
708+#define GEIS_GESTURE_TYPE_DRAG3 "Drag,touch=3"
709+#define GEIS_GESTURE_TYPE_DRAG4 "Drag,touch=4"
710+#define GEIS_GESTURE_TYPE_DRAG5 "Drag,touch=5"
711+#define GEIS_GESTURE_TYPE_PINCH1 "Pinch,touch=1"
712+#define GEIS_GESTURE_TYPE_PINCH2 "Pinch,touch=2"
713+#define GEIS_GESTURE_TYPE_PINCH3 "Pinch,touch=3"
714+#define GEIS_GESTURE_TYPE_PINCH4 "Pinch,touch=4"
715+#define GEIS_GESTURE_TYPE_PINCH5 "Pinch,touch=5"
716+#define GEIS_GESTURE_TYPE_ROTATE1 "Rotate,touch=1"
717+#define GEIS_GESTURE_TYPE_ROTATE2 "Rotate,touch=2"
718+#define GEIS_GESTURE_TYPE_ROTATE3 "Rotate,touch=3"
719+#define GEIS_GESTURE_TYPE_ROTATE4 "Rotate,touch=4"
720+#define GEIS_GESTURE_TYPE_ROTATE5 "Rotate,touch=5"
721+#define GEIS_GESTURE_TYPE_TAP1 "Tap,touch=1"
722+#define GEIS_GESTURE_TYPE_TAP2 "Tap,touch=2"
723+#define GEIS_GESTURE_TYPE_TAP3 "Tap,touch=3"
724+#define GEIS_GESTURE_TYPE_TAP4 "Tap,touch=4"
725+#define GEIS_GESTURE_TYPE_TAP5 "Tap,touch=5"
726+
727 /* Standard fundamental gesture attributes */
728 #define GEIS_GESTURE_ATTRIBUTE_ANGLE "angle"
729 #define GEIS_GESTURE_ATTRIBUTE_ANGLE_DELTA "angle delta"
730@@ -43,7 +65,6 @@
731 #define GEIS_GESTURE_ATTRIBUTE_DELTA_Y "delta y"
732 #define GEIS_GESTURE_ATTRIBUTE_DEVICE_ID "device id"
733 #define GEIS_GESTURE_ATTRIBUTE_EVENT_WINDOW_ID "event window id"
734-#define GEIS_GESTURE_ATTRIBUTE_FINGERS "fingers"
735 #define GEIS_GESTURE_ATTRIBUTE_FOCUS_X "focus x"
736 #define GEIS_GESTURE_ATTRIBUTE_FOCUS_Y "focus y"
737 #define GEIS_GESTURE_ATTRIBUTE_GESTURE_NAME "gesture name"
738@@ -55,6 +76,7 @@
739 #define GEIS_GESTURE_ATTRIBUTE_ROOT_WINDOW_ID "root window id"
740 #define GEIS_GESTURE_ATTRIBUTE_TAP_TIME "tap time"
741 #define GEIS_GESTURE_ATTRIBUTE_TIMESTAMP "timestamp"
742+#define GEIS_GESTURE_ATTRIBUTE_TOUCHES "touches"
743 #define GEIS_GESTURE_ATTRIBUTE_VELOCITY_X "velocity x"
744 #define GEIS_GESTURE_ATTRIBUTE_VELOCITY_Y "velocity y"
745 #define GEIS_GESTURE_ATTRIBUTE_TOUCH_0_ID "touch 0 id"
746@@ -271,7 +293,7 @@
747 * @retval GEIS_STATUS_SUCCESS normal successful completion
748 */
749 GEIS_API GeisStatus geis_input_devices(GeisInstance geis_instance,
750- GeisInputFuncs func,
751+ GeisInputFuncs *func,
752 void *cookie);
753
754 /* @} */
755
756=== modified file 'libutouch-geis-xcb/Makefile.am'
757--- libutouch-geis-xcb/Makefile.am 2010-08-23 14:54:15 +0000
758+++ libutouch-geis-xcb/Makefile.am 2010-09-16 16:28:52 +0000
759@@ -16,9 +16,10 @@
760
761 libutouch_geis_la_SOURCES = \
762 geis.c \
763- geis_debug.h \
764- geis_xcb.h geis_xcb.c \
765- geis_instance.h geis_instance.c
766+ geis_logging.h geis_logging.c \
767+ geis_instance.h geis_instance.c \
768+ geis_instance_table.h geis_instance_table.c \
769+ geis_xcb.h geis_xcb.c
770
771 dist_libutouch_geis_la_SOURCES = \
772 xcb_gesture.h xcb_gesture.c
773@@ -29,15 +30,19 @@
774 -DGEIS_BUILDING_DSO=1 \
775 -I$(top_srcdir) \
776 $(GRAIL_CFLAGS) \
777- $(XCB_CFLAGS)
778+ $(X11XCB_CFLAGS) \
779+ $(XCB_CFLAGS) \
780+ $(XI2_CFLAGS)
781
782 libutouch_geis_la_LDFLAGS = \
783 -Wl,-z,defs -Wl,--as-needed \
784- -version-info 1:0:0 \
785+ -version-info 1:1:0 \
786 -Wl,--version-script=$(version_script)
787
788 libutouch_geis_la_LIBADD = \
789- $(XCB_LIBS)
790+ $(X11XCB_LIBS) \
791+ $(XCB_LIBS) \
792+ $(XI2_LIBS)
793
794 BUILT_SOURCES = $(dist_libutouch_geis_la_SOURCES)
795 CLEANFILES = $(dist_libutouch_geis_la_SOURCES)
796
797=== modified file 'libutouch-geis-xcb/Makefile.in'
798--- libutouch-geis-xcb/Makefile.in 2010-08-20 22:03:52 +0000
799+++ libutouch-geis-xcb/Makefile.in 2010-09-16 16:28:52 +0000
800@@ -73,10 +73,13 @@
801 am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(incdir)"
802 LTLIBRARIES = $(lib_LTLIBRARIES)
803 am__DEPENDENCIES_1 =
804-libutouch_geis_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
805+libutouch_geis_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
806+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
807 am_libutouch_geis_la_OBJECTS = libutouch_geis_la-geis.lo \
808- libutouch_geis_la-geis_xcb.lo \
809- libutouch_geis_la-geis_instance.lo
810+ libutouch_geis_la-geis_logging.lo \
811+ libutouch_geis_la-geis_instance.lo \
812+ libutouch_geis_la-geis_instance_table.lo \
813+ libutouch_geis_la-geis_xcb.lo
814 dist_libutouch_geis_la_OBJECTS = libutouch_geis_la-xcb_gesture.lo
815 libutouch_geis_la_OBJECTS = $(am_libutouch_geis_la_OBJECTS) \
816 $(dist_libutouch_geis_la_OBJECTS)
817@@ -173,6 +176,8 @@
818 SHELL = @SHELL@
819 STRIP = @STRIP@
820 VERSION = @VERSION@
821+X11XCB_CFLAGS = @X11XCB_CFLAGS@
822+X11XCB_LIBS = @X11XCB_LIBS@
823 XCBINCLUDEDIR = @XCBINCLUDEDIR@
824 XCBPROTO_XCBINCLUDEDIR = @XCBPROTO_XCBINCLUDEDIR@
825 XCBPROTO_XCBPYTHONDIR = @XCBPROTO_XCBPYTHONDIR@
826@@ -180,6 +185,8 @@
827 # work around a problem with XCB tools
828 XCB_CFLAGS = @XCB_CFLAGS@ -I$(includedir)/xcb -I$(XCBINCLUDEDIR)/xcb
829 XCB_LIBS = @XCB_LIBS@
830+XI2_CFLAGS = @XI2_CFLAGS@
831+XI2_LIBS = @XI2_LIBS@
832 abs_builddir = @abs_builddir@
833 abs_srcdir = @abs_srcdir@
834 abs_top_builddir = @abs_top_builddir@
835@@ -248,9 +255,10 @@
836 lib_LTLIBRARIES = libutouch-geis.la
837 libutouch_geis_la_SOURCES = \
838 geis.c \
839- geis_debug.h \
840- geis_xcb.h geis_xcb.c \
841- geis_instance.h geis_instance.c
842+ geis_logging.h geis_logging.c \
843+ geis_instance.h geis_instance.c \
844+ geis_instance_table.h geis_instance_table.c \
845+ geis_xcb.h geis_xcb.c
846
847 dist_libutouch_geis_la_SOURCES = \
848 xcb_gesture.h xcb_gesture.c
849@@ -261,15 +269,19 @@
850 -DGEIS_BUILDING_DSO=1 \
851 -I$(top_srcdir) \
852 $(GRAIL_CFLAGS) \
853- $(XCB_CFLAGS)
854+ $(X11XCB_CFLAGS) \
855+ $(XCB_CFLAGS) \
856+ $(XI2_CFLAGS)
857
858 libutouch_geis_la_LDFLAGS = \
859 -Wl,-z,defs -Wl,--as-needed \
860- -version-info 1:0:0 \
861+ -version-info 1:1:0 \
862 -Wl,--version-script=$(version_script)
863
864 libutouch_geis_la_LIBADD = \
865- $(XCB_LIBS)
866+ $(X11XCB_LIBS) \
867+ $(XCB_LIBS) \
868+ $(XI2_LIBS)
869
870 BUILT_SOURCES = $(dist_libutouch_geis_la_SOURCES)
871 CLEANFILES = $(dist_libutouch_geis_la_SOURCES)
872@@ -354,6 +366,8 @@
873
874 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libutouch_geis_la-geis.Plo@am__quote@
875 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libutouch_geis_la-geis_instance.Plo@am__quote@
876+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libutouch_geis_la-geis_instance_table.Plo@am__quote@
877+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libutouch_geis_la-geis_logging.Plo@am__quote@
878 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libutouch_geis_la-geis_xcb.Plo@am__quote@
879 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libutouch_geis_la-xcb_gesture.Plo@am__quote@
880
881@@ -385,6 +399,27 @@
882 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
883 @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libutouch_geis_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libutouch_geis_la-geis.lo `test -f 'geis.c' || echo '$(srcdir)/'`geis.c
884
885+libutouch_geis_la-geis_logging.lo: geis_logging.c
886+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libutouch_geis_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libutouch_geis_la-geis_logging.lo -MD -MP -MF $(DEPDIR)/libutouch_geis_la-geis_logging.Tpo -c -o libutouch_geis_la-geis_logging.lo `test -f 'geis_logging.c' || echo '$(srcdir)/'`geis_logging.c
887+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libutouch_geis_la-geis_logging.Tpo $(DEPDIR)/libutouch_geis_la-geis_logging.Plo
888+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='geis_logging.c' object='libutouch_geis_la-geis_logging.lo' libtool=yes @AMDEPBACKSLASH@
889+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
890+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libutouch_geis_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libutouch_geis_la-geis_logging.lo `test -f 'geis_logging.c' || echo '$(srcdir)/'`geis_logging.c
891+
892+libutouch_geis_la-geis_instance.lo: geis_instance.c
893+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libutouch_geis_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libutouch_geis_la-geis_instance.lo -MD -MP -MF $(DEPDIR)/libutouch_geis_la-geis_instance.Tpo -c -o libutouch_geis_la-geis_instance.lo `test -f 'geis_instance.c' || echo '$(srcdir)/'`geis_instance.c
894+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libutouch_geis_la-geis_instance.Tpo $(DEPDIR)/libutouch_geis_la-geis_instance.Plo
895+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='geis_instance.c' object='libutouch_geis_la-geis_instance.lo' libtool=yes @AMDEPBACKSLASH@
896+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
897+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libutouch_geis_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libutouch_geis_la-geis_instance.lo `test -f 'geis_instance.c' || echo '$(srcdir)/'`geis_instance.c
898+
899+libutouch_geis_la-geis_instance_table.lo: geis_instance_table.c
900+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libutouch_geis_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libutouch_geis_la-geis_instance_table.lo -MD -MP -MF $(DEPDIR)/libutouch_geis_la-geis_instance_table.Tpo -c -o libutouch_geis_la-geis_instance_table.lo `test -f 'geis_instance_table.c' || echo '$(srcdir)/'`geis_instance_table.c
901+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libutouch_geis_la-geis_instance_table.Tpo $(DEPDIR)/libutouch_geis_la-geis_instance_table.Plo
902+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='geis_instance_table.c' object='libutouch_geis_la-geis_instance_table.lo' libtool=yes @AMDEPBACKSLASH@
903+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
904+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libutouch_geis_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libutouch_geis_la-geis_instance_table.lo `test -f 'geis_instance_table.c' || echo '$(srcdir)/'`geis_instance_table.c
905+
906 libutouch_geis_la-geis_xcb.lo: geis_xcb.c
907 @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libutouch_geis_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libutouch_geis_la-geis_xcb.lo -MD -MP -MF $(DEPDIR)/libutouch_geis_la-geis_xcb.Tpo -c -o libutouch_geis_la-geis_xcb.lo `test -f 'geis_xcb.c' || echo '$(srcdir)/'`geis_xcb.c
908 @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libutouch_geis_la-geis_xcb.Tpo $(DEPDIR)/libutouch_geis_la-geis_xcb.Plo
909@@ -392,13 +427,6 @@
910 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
911 @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libutouch_geis_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libutouch_geis_la-geis_xcb.lo `test -f 'geis_xcb.c' || echo '$(srcdir)/'`geis_xcb.c
912
913-libutouch_geis_la-geis_instance.lo: geis_instance.c
914-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libutouch_geis_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libutouch_geis_la-geis_instance.lo -MD -MP -MF $(DEPDIR)/libutouch_geis_la-geis_instance.Tpo -c -o libutouch_geis_la-geis_instance.lo `test -f 'geis_instance.c' || echo '$(srcdir)/'`geis_instance.c
915-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libutouch_geis_la-geis_instance.Tpo $(DEPDIR)/libutouch_geis_la-geis_instance.Plo
916-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='geis_instance.c' object='libutouch_geis_la-geis_instance.lo' libtool=yes @AMDEPBACKSLASH@
917-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
918-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libutouch_geis_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libutouch_geis_la-geis_instance.lo `test -f 'geis_instance.c' || echo '$(srcdir)/'`geis_instance.c
919-
920 libutouch_geis_la-xcb_gesture.lo: xcb_gesture.c
921 @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libutouch_geis_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libutouch_geis_la-xcb_gesture.lo -MD -MP -MF $(DEPDIR)/libutouch_geis_la-xcb_gesture.Tpo -c -o libutouch_geis_la-xcb_gesture.lo `test -f 'xcb_gesture.c' || echo '$(srcdir)/'`xcb_gesture.c
922 @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libutouch_geis_la-xcb_gesture.Tpo $(DEPDIR)/libutouch_geis_la-xcb_gesture.Plo
923
924=== modified file 'libutouch-geis-xcb/geis.c'
925--- libutouch-geis-xcb/geis.c 2010-08-11 13:54:54 +0000
926+++ libutouch-geis-xcb/geis.c 2010-09-16 16:28:52 +0000
927@@ -20,9 +20,13 @@
928 #include <geis/geis.h>
929
930 #include "geis_instance.h"
931+#include "geis_xcb.h"
932 #include <stdlib.h>
933
934
935+static GeisXcb s_geis_xcb = NULL;
936+
937+
938 /**
939 * @param[in] win_info
940 * @param[out] geis_instance
941@@ -34,13 +38,19 @@
942 geis_init(GeisWinInfo *win_info, GeisInstance *geis_instance)
943 {
944 *geis_instance = NULL;
945+ GeisXcbWinInfo *xcb_win_info = (GeisXcbWinInfo*)win_info->win_info;
946
947 if (win_info->win_type != GEIS_XCB_FULL_WINDOW)
948 {
949 return GEIS_BAD_ARGUMENT;
950 }
951
952- *geis_instance = geis_instance_get((GeisXcbWinInfo*)win_info->win_info);
953+ if (!s_geis_xcb)
954+ {
955+ s_geis_xcb = geis_xcb_new(xcb_win_info);
956+ }
957+
958+ *geis_instance = geis_xcb_create_instance(s_geis_xcb, xcb_win_info->window_id);
959 return GEIS_STATUS_SUCCESS;
960 }
961
962@@ -109,7 +119,7 @@
963 switch (configuration_item)
964 {
965 case GEIS_CONFIG_UNIX_FD:
966- *(int *)value = geis_instance_fd(geis_instance);
967+ *(int *)value = geis_xcb_fd(s_geis_xcb);
968 status = GEIS_STATUS_SUCCESS;
969 break;
970 }
971@@ -147,7 +157,7 @@
972 return GEIS_BAD_ARGUMENT;
973 }
974
975- geis_instance_event_dispatch(geis_instance);
976+ geis_xcb_dispatch(s_geis_xcb);
977 return GEIS_STATUS_SUCCESS;
978 }
979
980@@ -159,7 +169,7 @@
981 */
982 GeisStatus
983 geis_input_devices(GeisInstance geis_instance,
984- GeisInputFuncs funcs,
985+ GeisInputFuncs *funcs,
986 void *cookie)
987 {
988 if (!geis_instance_is_valid(geis_instance))
989@@ -167,7 +177,7 @@
990 return GEIS_BAD_ARGUMENT;
991 }
992
993- return GEIS_UNKNOWN_ERROR;
994+ return geis_xcb_input_devices(s_geis_xcb, funcs, cookie);
995 }
996
997
998@@ -191,6 +201,7 @@
999 }
1000
1001 return geis_instance_subscribe(geis_instance,
1002+ s_geis_xcb,
1003 input_list,
1004 gesture_list,
1005 funcs,
1006
1007=== removed file 'libutouch-geis-xcb/geis_debug.h'
1008--- libutouch-geis-xcb/geis_debug.h 2010-08-11 13:54:54 +0000
1009+++ libutouch-geis-xcb/geis_debug.h 1970-01-01 00:00:00 +0000
1010@@ -1,27 +0,0 @@
1011-/**
1012- * @file geis_debug,h
1013- *
1014- * Copyright 2010 Canonical Ltd.
1015- *
1016- * This library is free software; you can redistribute it and/or modify it under
1017- * the terms of the GNU Lesser General Public License as published by the Free
1018- * Software Foundation; either version 3 of the License, or (at your option) any
1019- * later version.
1020- *
1021- * This library is distributed in the hope that it will be useful, but WITHOUT
1022- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1023- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
1024- * details.
1025- *
1026- * You should have received a copy of the GNU Lesser General Public License
1027- * along with this program; if not, write to the Free Software Foundation, Inc.,
1028- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1029- */
1030-#ifndef GEIS_DEBUG_H_
1031-#define GEIS_DEBUG_H_
1032-
1033-#include <stdio.h>
1034-
1035-#define geis_debug printf
1036-
1037-#endif /* GEIS_DEBUG_H_ */
1038
1039=== modified file 'libutouch-geis-xcb/geis_instance.c'
1040--- libutouch-geis-xcb/geis_instance.c 2010-08-11 13:54:54 +0000
1041+++ libutouch-geis-xcb/geis_instance.c 2010-09-16 16:28:52 +0000
1042@@ -19,17 +19,27 @@
1043 */
1044 #include "geis_instance.h"
1045
1046+#include "geis_logging.h"
1047 #include <stdlib.h>
1048
1049
1050+/**
1051+ * Creates a new GeisInstance for an X11 windowId.
1052+ *
1053+ * @param[in] An X11 windowId.
1054+ *
1055+ * @returns a new GeisInstance or NULL on failure.
1056+ */
1057 GeisInstance
1058-geis_instance_get(GeisXcbWinInfo* win_info)
1059+geis_instance_new(uint32_t window_id)
1060 {
1061- GeisInstance instance = calloc(1, sizeof(GeisInstance));
1062- if (instance)
1063+ GeisInstance instance = calloc(1, sizeof(struct _GeisInstance));
1064+ if (!instance)
1065 {
1066- instance->xcb = geis_xcb_get(win_info);
1067+ geis_error("allocating GeisInstance");
1068+ return NULL;
1069 }
1070+ instance->window_id = window_id;
1071 return instance;
1072 }
1073
1074@@ -44,42 +54,52 @@
1075 int
1076 geis_instance_is_valid(GeisInstance instance)
1077 {
1078- return (instance != 0 && instance->xcb != 0);
1079+ return (instance != 0 && instance->window_id != 0);
1080 }
1081
1082
1083 GeisStatus
1084 geis_instance_subscribe(GeisInstance instance,
1085+ GeisXcb xcb,
1086 GeisInputDeviceId *input_list,
1087 const char* *gesture_list,
1088 GeisGestureFuncs *funcs,
1089 void *cookie)
1090 {
1091+ GeisStatus result = GEIS_UNKNOWN_ERROR;
1092 instance->gesture_funcs = funcs;
1093 instance->gesture_cookie = cookie;
1094- return geis_xcb_subscribe(instance, gesture_list);
1095-}
1096-
1097-
1098-int
1099-geis_instance_fd(GeisInstance instance)
1100-{
1101- if (instance == NULL)
1102- return -1;
1103-
1104- return geis_xcb_fd(instance->xcb);
1105-}
1106-
1107-
1108-void
1109-geis_instance_event_dispatch(GeisInstance instance)
1110-{
1111- geis_xcb_dispatch(instance);
1112+ if (input_list == GEIS_ALL_INPUT_DEVICES)
1113+ {
1114+ result = geis_xcb_subscribe(xcb, instance, 0, gesture_list);
1115+ }
1116+ else
1117+ {
1118+ GeisInputDeviceId *device_id = input_list;
1119+ for (; *device_id; ++device_id)
1120+ {
1121+ GeisStatus a_result = geis_xcb_subscribe(xcb, instance,
1122+ (uint16_t)*device_id,
1123+ gesture_list);
1124+ if (a_result == GEIS_STATUS_SUCCESS)
1125+ {
1126+ result = a_result;
1127+ }
1128+ }
1129+ }
1130+ return result;
1131+}
1132+
1133+
1134+uint32_t
1135+geis_instance_get_window_id(GeisInstance instance)
1136+{
1137+ return instance->window_id;
1138 }
1139
1140
1141 void
1142 geis_instance_free(GeisInstance instance)
1143 {
1144- geis_xcb_free(instance->xcb);
1145+ free(instance);
1146 }
1147
1148=== modified file 'libutouch-geis-xcb/geis_instance.h'
1149--- libutouch-geis-xcb/geis_instance.h 2010-08-23 14:54:18 +0000
1150+++ libutouch-geis-xcb/geis_instance.h 2010-09-16 16:28:52 +0000
1151@@ -26,31 +26,27 @@
1152
1153 struct _GeisInstance
1154 {
1155- GeisXcb *xcb;
1156- GeisInputCallback input_callback;
1157- void *input_cookie;
1158- GeisGestureFuncs *gesture_funcs;
1159- void *gesture_cookie;
1160+ uint32_t window_id;
1161+ GeisGestureFuncs *gesture_funcs;
1162+ void *gesture_cookie;
1163 };
1164
1165 /** @brief Constructs a GeisInstance. */
1166-GeisInstance geis_instance_get(GeisXcbWinInfo* win_info);
1167+GeisInstance geis_instance_new(uint32_t win_info);
1168+
1169
1170 /** @brief Indicates if the GeisInstance is valid. */
1171 int geis_instance_is_valid(GeisInstance instance);
1172
1173 /** @brief Subscribe to gestures. */
1174 GeisStatus geis_instance_subscribe(GeisInstance instance,
1175+ GeisXcb xcb,
1176 GeisInputDeviceId *input_list,
1177 const char* *gesture_list,
1178 GeisGestureFuncs *funcs,
1179 void *cookie);
1180
1181-/** @brief Gets the event file descriptor. */
1182-int geis_instance_fd(GeisInstance instance);
1183-
1184-/** @brief Dispatches events. */
1185-void geis_instance_event_dispatch(GeisInstance instance);
1186+uint32_t geis_instance_get_window_id(GeisInstance instance);
1187
1188 /** @brief Tears down the GeisInstance. */
1189 void geis_instance_free(GeisInstance instance);
1190
1191=== added file 'libutouch-geis-xcb/geis_instance_table.c'
1192--- libutouch-geis-xcb/geis_instance_table.c 1970-01-01 00:00:00 +0000
1193+++ libutouch-geis-xcb/geis_instance_table.c 2010-09-16 16:28:52 +0000
1194@@ -0,0 +1,127 @@
1195+/**
1196+ * geis_instance_table.h
1197+ *
1198+ * Copyright 2010 Canonical Ltd.
1199+ *
1200+ * This library is free software; you can redistribute it and/or modify it under
1201+ * the terms of the GNU Lesser General Public License as published by the Free
1202+ * Software Foundation; either version 3 of the License, or (at your option) any
1203+ * later version.
1204+ *
1205+ * This library is distributed in the hope that it will be useful, but WITHOUT
1206+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1207+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
1208+ * more details.
1209+ *
1210+ * You should have received a copy of the GNU General Public License along with
1211+ * this program; if not, write to the Free Software Foundation, Inc., 51
1212+ * Franklin St, Fifth Floor, Boston, MA 02110-1301 US
1213+ */
1214+#include "geis_instance_table.h"
1215+
1216+#include "geis_instance.h"
1217+#include <stdlib.h>
1218+
1219+#define GROWTH_FACTOR 2
1220+
1221+
1222+typedef struct _GeisInstanceTableEntry
1223+{
1224+ uint32_t id;
1225+ GeisInstance type;
1226+} *GeisInstanceTableEntry;
1227+
1228+struct _GeisInstanceTable
1229+{
1230+ size_t capacity;
1231+ size_t size;
1232+ GeisInstanceTableEntry data;
1233+};
1234+
1235+
1236+GeisInstanceTable
1237+geis_instance_table_new(int size_hint)
1238+{
1239+ GeisInstanceTable table = malloc(sizeof(struct _GeisInstanceTable));
1240+ if (!table)
1241+ {
1242+ /* TODO: report error */
1243+ }
1244+
1245+ table->capacity = size_hint;
1246+ table->size = 0;
1247+ table->data = calloc(table->capacity,
1248+ size_hint * sizeof(struct _GeisInstanceTableEntry));
1249+ if (!table->data)
1250+ {
1251+ /* TODO: report error */
1252+ }
1253+
1254+ return table;
1255+}
1256+
1257+
1258+/**
1259+ * Adds (or replaces) a gesture type in the table.
1260+ */
1261+void
1262+geis_instance_table_add(GeisInstanceTable table,
1263+ GeisInstance instance)
1264+{
1265+ size_t i;
1266+ uint32_t window_id = geis_instance_get_window_id(instance);
1267+
1268+ /* If the ID is already present, just replace the gesture type */
1269+ for (i = 0; i < table->size; ++i)
1270+ {
1271+ if (table->data[i].id == window_id)
1272+ {
1273+ table->data[i].type = instance;
1274+ return;
1275+ }
1276+ }
1277+
1278+ /* If there is no space to insert, grow the table. */
1279+ if (table->size >= table->capacity)
1280+ {
1281+ size_t new_capacity = table->capacity * GROWTH_FACTOR;
1282+ GeisInstanceTableEntry new_data = realloc(table->data,
1283+ new_capacity * sizeof(struct _GeisInstanceTableEntry));
1284+ if (!new_data)
1285+ {
1286+ /* TODO: report error */
1287+ }
1288+
1289+ table->capacity = new_capacity;
1290+ table->data = new_data;
1291+ }
1292+
1293+ table->data[table->size].id = window_id;
1294+ table->data[table->size].type = instance;
1295+ ++table->size;
1296+}
1297+
1298+
1299+GeisInstance
1300+geis_instance_table_get(GeisInstanceTable table,
1301+ uint32_t window_id)
1302+{
1303+ size_t i;
1304+ for (i = 0; i < table->size; ++i)
1305+ {
1306+ if (table->data[i].id == window_id)
1307+ {
1308+ return table->data[i].type;
1309+ }
1310+ }
1311+ return NULL;
1312+}
1313+
1314+
1315+void
1316+geis_instance_table_free(GeisInstanceTable table)
1317+{
1318+ free(table->data);
1319+ free(table);
1320+}
1321+
1322
1323=== added file 'libutouch-geis-xcb/geis_instance_table.h'
1324--- libutouch-geis-xcb/geis_instance_table.h 1970-01-01 00:00:00 +0000
1325+++ libutouch-geis-xcb/geis_instance_table.h 2010-09-16 16:28:52 +0000
1326@@ -0,0 +1,41 @@
1327+/**
1328+ * geis_instance_table.h
1329+ *
1330+ * Copyright 2010 Canonical Ltd.
1331+ *
1332+ * This library is free software; you can redistribute it and/or modify it under
1333+ * the terms of the GNU Lesser General Public License as published by the Free
1334+ * Software Foundation; either version 3 of the License, or (at your option) any
1335+ * later version.
1336+ *
1337+ * This library is distributed in the hope that it will be useful, but WITHOUT
1338+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1339+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
1340+ * more details.
1341+ *
1342+ * You should have received a copy of the GNU General Public License along with
1343+ * this program; if not, write to the Free Software Foundation, Inc., 51
1344+ * Franklin St, Fifth Floor, Boston, MA 02110-1301 US
1345+ */
1346+#ifndef GEIS_INSTANCE_TABLE_H_
1347+#define GEIS_INSTANCE_TABLE_H_
1348+
1349+#include "geis_config.h"
1350+#include <geis/geis.h>
1351+
1352+/**
1353+ * A map from XCB window IDs to geisInstances.
1354+ */
1355+typedef struct _GeisInstanceTable *GeisInstanceTable;
1356+
1357+GeisInstanceTable geis_instance_table_new(int size_hint);
1358+
1359+void geis_instance_table_add(GeisInstanceTable type_table,
1360+ GeisInstance instance);
1361+
1362+GeisInstance geis_instance_table_get(GeisInstanceTable type_table,
1363+ uint32_t window_id);
1364+
1365+void geis_instance_table_free(GeisInstanceTable type_table);
1366+
1367+#endif /* GEIS_INSTANCE_TABLE_H_ */
1368
1369=== added file 'libutouch-geis-xcb/geis_logging.c'
1370--- libutouch-geis-xcb/geis_logging.c 1970-01-01 00:00:00 +0000
1371+++ libutouch-geis-xcb/geis_logging.c 2010-09-16 16:28:52 +0000
1372@@ -0,0 +1,87 @@
1373+/**
1374+ * @file geis_logging.h
1375+ *
1376+ * Copyright 2010 Canonical Ltd.
1377+ *
1378+ * This library is free software; you can redistribute it and/or modify it under
1379+ * the terms of the GNU Lesser General Public License as published by the Free
1380+ * Software Foundation; either version 3 of the License, or (at your option) any
1381+ * later version.
1382+ *
1383+ * This library is distributed in the hope that it will be useful, but WITHOUT
1384+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1385+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
1386+ * details.
1387+ *
1388+ * You should have received a copy of the GNU Lesser General Public License
1389+ * along with this program; if not, write to the Free Software Foundation, Inc.,
1390+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1391+ */
1392+#include "geis_logging.h"
1393+
1394+#include <stdarg.h>
1395+#include <stdio.h>
1396+#include <stdlib.h>
1397+#include <string.h>
1398+
1399+
1400+static const char *prefix_format = "GEIS(%s)-%s:%d ";
1401+static const char *debug_marker = "debug";
1402+static const char *warning_marker = "warning";
1403+static const char *error_marker = "error";
1404+
1405+
1406+static int
1407+reporting_level()
1408+{
1409+ char *level = getenv("GEIS_DEBUG");
1410+ if (level)
1411+ {
1412+ return atoi(level);
1413+ }
1414+ return 0;
1415+}
1416+
1417+static int
1418+level_is_enabled(int desired_level)
1419+{
1420+ static int level = -1;
1421+ if (level < 0)
1422+ level = reporting_level();
1423+ return level >= desired_level;
1424+}
1425+
1426+
1427+int
1428+_geis_message(int level, const char* function, int line, const char *format, ...)
1429+{
1430+ int count = 0;
1431+ if (level_is_enabled(level))
1432+ {
1433+ const char *marker = NULL;
1434+ switch (level)
1435+ {
1436+ case _GEIS_LOG_LEVEL_DEBUG:
1437+ marker = debug_marker;
1438+ break;
1439+ case _GEIS_LOG_LEVEL_WARNING:
1440+ marker = warning_marker;
1441+ break;
1442+ default:
1443+ marker = error_marker;
1444+ break;
1445+ }
1446+
1447+ fprintf(stderr, prefix_format, marker, function, line);
1448+
1449+ va_list ap;
1450+ va_start(ap, format);
1451+ count = vfprintf(stderr, format, ap);
1452+ va_end(ap);
1453+
1454+ fprintf(stderr, "\n");
1455+ }
1456+ return count;
1457+}
1458+
1459+
1460
1461=== added file 'libutouch-geis-xcb/geis_logging.h'
1462--- libutouch-geis-xcb/geis_logging.h 1970-01-01 00:00:00 +0000
1463+++ libutouch-geis-xcb/geis_logging.h 2010-09-16 16:28:52 +0000
1464@@ -0,0 +1,64 @@
1465+/**
1466+ * @file geis_logging.h
1467+ * @brief internal GEIS debug/logging facilities
1468+ *
1469+ * Copyright 2010 Canonical Ltd.
1470+ *
1471+ * This library is free software; you can redistribute it and/or modify it under
1472+ * the terms of the GNU Lesser General Public License as published by the Free
1473+ * Software Foundation; either version 3 of the License, or (at your option) any
1474+ * later version.
1475+ *
1476+ * This library is distributed in the hope that it will be useful, but WITHOUT
1477+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1478+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
1479+ * details.
1480+ *
1481+ * You should have received a copy of the GNU Lesser General Public License
1482+ * along with this program; if not, write to the Free Software Foundation, Inc.,
1483+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1484+ */
1485+#ifndef GEIS_LOGGING_H_
1486+#define GEIS_LOGGING_H_
1487+
1488+/**
1489+ * @defgroup geis_logging GEIS Logging Facilities
1490+ *
1491+ * This facility allows the run-time delivery of debugging and error emssages
1492+ * from the library. By default, no debug or error diagnostics are emitted by
1493+ * the library. However, if the environment variable GEIS_DEBUG is set to an
1494+ * appropriate value, these diagnostic messages will be emitted to stderr.
1495+ *
1496+ * The following GEIS_DEBUG values are supported.
1497+ *
1498+ * GEIS_DEBUG=1 error messages only are emitted
1499+ * GEIS_DEBUG=2 error and warning messages are emitted
1500+ * GEIS_DEBUG=3 error, warning, and debug messages are emitted
1501+ *
1502+ * @{
1503+ */
1504+
1505+#define _GEIS_LOG_LEVEL_ERROR 1
1506+#define _GEIS_LOG_LEVEL_WARNING 2
1507+#define _GEIS_LOG_LEVEL_DEBUG 3
1508+
1509+/**
1510+ * Emits a message at the DEBUG logging level.
1511+ * @param[in] fmt printf-style format string
1512+ */
1513+#define geis_debug(...) _geis_message(_GEIS_LOG_LEVEL_DEBUG, \
1514+ __FUNCTION__, __LINE__, \
1515+ __VA_ARGS__)
1516+#define geis_warning(...) _geis_message(_GEIS_LOG_LEVEL_WARNING, \
1517+ __FUNCTION__, __LINE__, \
1518+ __VA_ARGS__)
1519+#define geis_error(...) _geis_message(_GEIS_LOG_LEVEL_ERROR, \
1520+ __FUNCTION__, __LINE__, \
1521+ __VA_ARGS__)
1522+int _geis_message(int level,
1523+ const char *function, int line,
1524+ const char *format, ...) __attribute__((format(printf, 4, 5)));
1525+
1526+/* @} */
1527+
1528+#endif /* GEIS_LOGGING_H_ */
1529
1530=== modified file 'libutouch-geis-xcb/geis_xcb.c'
1531--- libutouch-geis-xcb/geis_xcb.c 2010-08-23 14:54:15 +0000
1532+++ libutouch-geis-xcb/geis_xcb.c 2010-09-16 16:28:52 +0000
1533@@ -19,12 +19,14 @@
1534 */
1535 #include "geis_xcb.h"
1536
1537-#include "geis_debug.h"
1538 #include "geis_instance.h"
1539+#include "geis_instance_table.h"
1540+#include "geis_logging.h"
1541 #include <grail.h>
1542 #include <grail-types.h>
1543 #include <stdlib.h>
1544 #include <string.h>
1545+#include <X11/Xlib-xcb.h>
1546 #include <X11/X.h>
1547 #include "xcb_gesture.h"
1548 #include <xcb/xcb.h>
1549@@ -32,15 +34,12 @@
1550 struct _GeisXcb
1551 {
1552 GeisXcbWinInfo *win_info;
1553+ Display *display;
1554 xcb_connection_t *connection;
1555 int fd;
1556-};
1557-
1558-static GeisXcb s_geis_xcb =
1559-{
1560- NULL,
1561- NULL,
1562- -1
1563+ GeisInstanceTable instance_table;
1564+ GeisInputFuncs *input_funcs;
1565+ void *input_cookie;
1566 };
1567
1568 typedef struct _GrailAttrMap
1569@@ -171,71 +170,182 @@
1570
1571 static const GrailTypeMap s_grail_type_map[] =
1572 {
1573- { GEIS_GESTURE_TYPE_DRAG, GEIS_GESTURE_DRAG, sizeof(s_grail_drag_attrs) / sizeof(GrailAttrMap), s_grail_drag_attrs },
1574- { GEIS_GESTURE_TYPE_PINCH, GEIS_GESTURE_PINCH, sizeof(s_grail_pinch_attrs) / sizeof(GrailAttrMap), s_grail_pinch_attrs },
1575- { GEIS_GESTURE_TYPE_ROTATE, GEIS_GESTURE_ROTATE, sizeof(s_grail_rotate_attrs) / sizeof(GrailAttrMap), s_grail_rotate_attrs },
1576- { GEIS_GESTURE_TYPE_TAP, GEIS_GESTURE_TAP, sizeof(s_grail_tap_attrs) / sizeof(GrailAttrMap), s_grail_tap_attrs },
1577- { 0, 0, 0, 0 }
1578-};
1579-
1580-
1581-GeisGestureAttr s_name_attr =
1582-{
1583- .name="name",
1584- .type=GEIS_ATTR_TYPE_STRING
1585-};
1586-
1587-/**
1588- * Dispatches gesture events to the instance's callback.
1589- */
1590-static void
1591-geis_xcb_dispatch_gesture_type(GeisInstance instance,
1592- const char **gesture_list)
1593-{
1594- if (gesture_list == GEIS_ALL_GESTURES)
1595- {
1596- const GrailTypeMap *type = s_grail_type_map;
1597- for (; type->name; ++type)
1598- {
1599- s_name_attr.string_val = type->name;
1600- if (instance->gesture_funcs &&
1601- instance->gesture_funcs->added)
1602- {
1603- instance->gesture_funcs->added (instance->gesture_cookie,
1604- type->type,
1605- 0,
1606- 1, &s_name_attr);
1607- }
1608- }
1609- }
1610- else
1611- {
1612- const char **gesture = NULL;
1613- for (gesture = gesture_list; *gesture; ++gesture)
1614- {
1615- const GrailTypeMap *type = s_grail_type_map;
1616- for (; type->name; ++type)
1617- {
1618- if (strcmp(type->name, *gesture) == 0)
1619- {
1620- s_name_attr.string_val = type->name;
1621- if (instance->gesture_funcs && instance->gesture_funcs->added)
1622- {
1623- instance->gesture_funcs->added (instance->gesture_cookie,
1624- type->type,
1625- 0,
1626- 1, &s_name_attr);
1627- }
1628-
1629- break;
1630- }
1631- }
1632- }
1633- }
1634-}
1635+ {
1636+ GEIS_GESTURE_TYPE_DRAG,
1637+ GEIS_GESTURE_DRAG,
1638+ sizeof(s_grail_drag_attrs) / sizeof(GrailAttrMap),
1639+ s_grail_drag_attrs
1640+ },
1641+ {
1642+ GEIS_GESTURE_TYPE_PINCH,
1643+ GEIS_GESTURE_PINCH,
1644+ sizeof(s_grail_pinch_attrs) / sizeof(GrailAttrMap),
1645+ s_grail_pinch_attrs
1646+ },
1647+ {
1648+ GEIS_GESTURE_TYPE_ROTATE,
1649+ GEIS_GESTURE_ROTATE,
1650+ sizeof(s_grail_rotate_attrs) / sizeof(GrailAttrMap),
1651+ s_grail_rotate_attrs
1652+ },
1653+ {
1654+ GEIS_GESTURE_TYPE_TAP,
1655+ GEIS_GESTURE_TAP,
1656+ sizeof(s_grail_tap_attrs) / sizeof(GrailAttrMap),
1657+ s_grail_tap_attrs
1658+ },
1659+ {
1660+ GRAIL_TYPE_DRAG2,
1661+ GEIS_GESTURE_TYPE_DRAG2,
1662+ sizeof(s_grail_drag_attrs) / sizeof(GrailAttrMap),
1663+ s_grail_drag_attrs
1664+ },
1665+ {
1666+ GRAIL_TYPE_PINCH2,
1667+ GEIS_GESTURE_TYPE_PINCH2,
1668+ sizeof(s_grail_pinch_attrs) / sizeof(GrailAttrMap),
1669+ s_grail_pinch_attrs
1670+ },
1671+ {
1672+ GRAIL_TYPE_ROTATE2,
1673+ GEIS_GESTURE_TYPE_ROTATE2,
1674+ sizeof(s_grail_rotate_attrs) / sizeof(GrailAttrMap),
1675+ s_grail_rotate_attrs
1676+ },
1677+ {
1678+ GRAIL_TYPE_DRAG3,
1679+ GEIS_GESTURE_TYPE_DRAG3,
1680+ sizeof(s_grail_drag_attrs) / sizeof(GrailAttrMap),
1681+ s_grail_drag_attrs
1682+ },
1683+ {
1684+ GRAIL_TYPE_PINCH3,
1685+ GEIS_GESTURE_TYPE_PINCH3,
1686+ sizeof(s_grail_pinch_attrs) / sizeof(GrailAttrMap),
1687+ s_grail_pinch_attrs
1688+ },
1689+ {
1690+ GRAIL_TYPE_ROTATE3,
1691+ GEIS_GESTURE_TYPE_ROTATE3,
1692+ sizeof(s_grail_rotate_attrs) / sizeof(GrailAttrMap),
1693+ s_grail_rotate_attrs
1694+ },
1695+ {
1696+ GRAIL_TYPE_DRAG4,
1697+ GEIS_GESTURE_TYPE_DRAG4,
1698+ sizeof(s_grail_drag_attrs) / sizeof(GrailAttrMap),
1699+ s_grail_drag_attrs
1700+ },
1701+ {
1702+ GRAIL_TYPE_PINCH4,
1703+ GEIS_GESTURE_TYPE_PINCH4,
1704+ sizeof(s_grail_pinch_attrs) / sizeof(GrailAttrMap),
1705+ s_grail_pinch_attrs
1706+ },
1707+ {
1708+ GRAIL_TYPE_ROTATE4,
1709+ GEIS_GESTURE_TYPE_ROTATE4,
1710+ sizeof(s_grail_rotate_attrs) / sizeof(GrailAttrMap),
1711+ s_grail_rotate_attrs
1712+ },
1713+ {
1714+ GRAIL_TYPE_DRAG5,
1715+ GEIS_GESTURE_TYPE_DRAG5,
1716+ sizeof(s_grail_drag_attrs) / sizeof(GrailAttrMap),
1717+ s_grail_drag_attrs
1718+ },
1719+ {
1720+ GRAIL_TYPE_PINCH5,
1721+ GEIS_GESTURE_TYPE_PINCH5,
1722+ sizeof(s_grail_pinch_attrs) / sizeof(GrailAttrMap),
1723+ s_grail_pinch_attrs
1724+ },
1725+ {
1726+ GRAIL_TYPE_ROTATE5,
1727+ GEIS_GESTURE_TYPE_ROTATE5,
1728+ sizeof(s_grail_rotate_attrs) / sizeof(GrailAttrMap),
1729+ s_grail_rotate_attrs
1730+ },
1731+ {
1732+ GRAIL_TYPE_TAP1,
1733+ GEIS_GESTURE_TYPE_TAP1,
1734+ sizeof(s_grail_tap_attrs) / sizeof(GrailAttrMap),
1735+ s_grail_tap_attrs
1736+ },
1737+ {
1738+ GRAIL_TYPE_TAP2,
1739+ GEIS_GESTURE_TYPE_TAP2,
1740+ sizeof(s_grail_tap_attrs) / sizeof(GrailAttrMap),
1741+ s_grail_tap_attrs
1742+ },
1743+ {
1744+ GRAIL_TYPE_TAP3,
1745+ GEIS_GESTURE_TYPE_TAP3,
1746+ sizeof(s_grail_tap_attrs) / sizeof(GrailAttrMap),
1747+ s_grail_tap_attrs
1748+ },
1749+ {
1750+ GRAIL_TYPE_TAP4,
1751+ GEIS_GESTURE_TYPE_TAP4,
1752+ sizeof(s_grail_tap_attrs) / sizeof(GrailAttrMap),
1753+ s_grail_tap_attrs
1754+ },
1755+ {
1756+ GRAIL_TYPE_TAP5,
1757+ GEIS_GESTURE_TYPE_TAP5,
1758+ sizeof(s_grail_tap_attrs) / sizeof(GrailAttrMap),
1759+ s_grail_tap_attrs
1760+ },
1761+ // special (undocumented) gestures available in Grail
1762+ {
1763+ GRAIL_TYPE_EDRAG,
1764+ "EDrag",
1765+ sizeof(s_grail_drag_attrs) / sizeof(GrailAttrMap),
1766+ s_grail_drag_attrs
1767+ },
1768+ {
1769+ GRAIL_TYPE_EPINCH,
1770+ "EPinch",
1771+ sizeof(s_grail_drag_attrs) / sizeof(GrailAttrMap),
1772+ s_grail_drag_attrs
1773+ },
1774+ {
1775+ GRAIL_TYPE_EROTATE,
1776+ "ERotate",
1777+ sizeof(s_grail_drag_attrs) / sizeof(GrailAttrMap),
1778+ s_grail_drag_attrs
1779+ },
1780+ {
1781+ GRAIL_TYPE_MDRAG,
1782+ "MDrag",
1783+ sizeof(s_grail_drag_attrs) / sizeof(GrailAttrMap),
1784+ s_grail_drag_attrs
1785+ },
1786+ {
1787+ GRAIL_TYPE_MPINCH,
1788+ "MPinch",
1789+ sizeof(s_grail_drag_attrs) / sizeof(GrailAttrMap),
1790+ s_grail_drag_attrs
1791+ },
1792+ {
1793+ GRAIL_TYPE_MROTATE,
1794+ "MRotate",
1795+ sizeof(s_grail_drag_attrs) / sizeof(GrailAttrMap),
1796+ s_grail_drag_attrs
1797+ },
1798+ { 0, NULL, 0, NULL }
1799+};
1800+
1801+
1802+
1803+GeisGestureAttr s_name_attr[2] =
1804+{
1805+ { GEIS_GESTURE_ATTRIBUTE_GESTURE_NAME, GEIS_ATTR_TYPE_STRING, 0 },
1806+ { GEIS_GESTURE_ATTRIBUTE_TOUCHES, GEIS_ATTR_TYPE_INTEGER, 0 }
1807+};
1808
1809 static GeisInteger
1810-geis_xcb_determine_gesture_type(int xcb_gesture_type)
1811+geis_xcb_determine_primitive_type(int xcb_gesture_type)
1812 {
1813 switch (xcb_gesture_type)
1814 {
1815@@ -322,6 +432,75 @@
1816 return 0;
1817 }
1818
1819+static const char *
1820+geis_xcb_get_gesture_type_primitive_name(GeisInteger gesture_type)
1821+{
1822+ GeisInteger primitive_type = geis_xcb_determine_primitive_type(gesture_type);
1823+ const GrailTypeMap *type = s_grail_type_map;
1824+ for (; type->name; ++type)
1825+ {
1826+ if (type->type == primitive_type)
1827+ {
1828+ return type->name;
1829+ }
1830+ }
1831+ return "unknown";
1832+}
1833+
1834+/**
1835+ * Dispatches gesture events to the instance's callback.
1836+ */
1837+static void
1838+geis_xcb_dispatch_gesture_type(GeisInstance instance,
1839+ const char **gesture_list)
1840+{
1841+ if (gesture_list == GEIS_ALL_GESTURES)
1842+ {
1843+ const GrailTypeMap *type = s_grail_type_map;
1844+ for (; type->name; ++type)
1845+ {
1846+ s_name_attr[0].string_val =
1847+ geis_xcb_get_gesture_type_primitive_name(type->type);
1848+ s_name_attr[1].integer_val = geis_xcb_determine_fingers(type->type);
1849+ if (instance->gesture_funcs && instance->gesture_funcs->added)
1850+ {
1851+ instance->gesture_funcs->added(instance->gesture_cookie,
1852+ type->type,
1853+ 0,
1854+ sizeof(s_name_attr) / sizeof(GeisGestureAttr),
1855+ s_name_attr);
1856+ }
1857+ }
1858+ }
1859+ else
1860+ {
1861+ const char **gesture = NULL;
1862+ for (gesture = gesture_list; *gesture; ++gesture)
1863+ {
1864+ const GrailTypeMap *type = s_grail_type_map;
1865+ for (; type->name; ++type)
1866+ {
1867+ if (strcmp(type->name, *gesture) == 0)
1868+ {
1869+ s_name_attr[0].string_val =
1870+ geis_xcb_get_gesture_type_primitive_name(type->type);
1871+ s_name_attr[1].integer_val = geis_xcb_determine_fingers(type->type);
1872+ if (instance->gesture_funcs && instance->gesture_funcs->added)
1873+ {
1874+ instance->gesture_funcs->added(instance->gesture_cookie,
1875+ type->type,
1876+ 0,
1877+ sizeof(s_name_attr) / sizeof(GeisGestureAttr),
1878+ s_name_attr);
1879+ }
1880+
1881+ break;
1882+ }
1883+ }
1884+ }
1885+ }
1886+}
1887+
1888 /**
1889 * Dispatches gesture events to the instance's callback.
1890 */
1891@@ -332,7 +511,7 @@
1892 static const int num_standard_attrs = 9;
1893 int num_attrs = num_standard_attrs + event->num_props;
1894 float *properties = NULL;
1895- GeisInteger gesture_type = geis_xcb_determine_gesture_type(event->gesture_type);
1896+ GeisInteger gesture_type = geis_xcb_determine_primitive_type(event->gesture_type);
1897
1898 GeisGestureAttr *attrs = calloc(num_attrs, sizeof(GeisGestureAttr));
1899 if (!attrs)
1900@@ -362,7 +541,7 @@
1901 attrs[6].type = GEIS_ATTR_TYPE_FLOAT;
1902 attrs[6].float_val = event->focus_y;
1903
1904- attrs[8].name = GEIS_GESTURE_ATTRIBUTE_FINGERS;
1905+ attrs[8].name = GEIS_GESTURE_ATTRIBUTE_TOUCHES;
1906 attrs[8].type = GEIS_ATTR_TYPE_INTEGER;
1907 attrs[8].integer_val = geis_xcb_determine_fingers(event->gesture_type);
1908
1909@@ -442,82 +621,114 @@
1910 }
1911
1912
1913-/**
1914- * @param[in] win_info
1915- */
1916-GeisXcb *
1917-geis_xcb_get(GeisXcbWinInfo *win_info)
1918-{
1919- if (!s_geis_xcb.connection)
1920- {
1921- xcb_generic_error_t *error;
1922-
1923- s_geis_xcb.win_info = win_info;
1924- s_geis_xcb.connection = xcb_connect(win_info->display_name,
1925- win_info->screenp);
1926- if (!s_geis_xcb.connection)
1927- {
1928- geis_debug("error connecting to X server.");
1929- return NULL;
1930- }
1931-
1932-#if 0
1933- {
1934- char buffer[128];
1935- xcb_input_get_extension_version_cookie_t input_version_cookie;
1936-
1937- input_version_cookie = xcb_input_get_extension_version(s_geis_xcb.connection,
1938- 127,
1939- buffer);
1940- }
1941-#endif
1942-
1943- {
1944- xcb_gesture_query_version_cookie_t version_cookie;
1945- xcb_gesture_query_version_reply_t *version_reply = NULL;
1946-
1947- version_cookie = xcb_gesture_query_version(s_geis_xcb.connection,
1948- XCB_GESTURE_MAJOR_VERSION,
1949- XCB_GESTURE_MINOR_VERSION);
1950- version_reply = xcb_gesture_query_version_reply(s_geis_xcb.connection,
1951- version_cookie,
1952- &error);
1953- if (!version_reply)
1954- {
1955- geis_debug("failed to receive gesture version reply\n");
1956- return NULL;
1957- }
1958-
1959- if (version_reply->major_version != XCB_GESTURE_MAJOR_VERSION
1960- && version_reply->minor_version != XCB_GESTURE_MINOR_VERSION)
1961- {
1962- geis_debug("server supports unrecognized version: %d.%d\n",
1963- version_reply->major_version, version_reply->minor_version);
1964- return NULL;
1965- }
1966-
1967- free(version_reply);
1968- }
1969-
1970-
1971- s_geis_xcb.fd = xcb_get_file_descriptor(s_geis_xcb.connection);
1972- }
1973-
1974- return &s_geis_xcb;
1975-}
1976-
1977-
1978+GeisXcb
1979+geis_xcb_new(GeisXcbWinInfo *win_info)
1980+{
1981+ GeisXcb xcb = calloc(1, sizeof(struct _GeisXcb));
1982+ if (!xcb)
1983+ {
1984+ geis_error("error allocating GeisXcb");
1985+ return NULL;
1986+ }
1987+
1988+ xcb->win_info = win_info;
1989+ xcb->display = XOpenDisplay(win_info->display_name);
1990+ if (!xcb->display)
1991+ {
1992+ geis_error("error opening X server.");
1993+ goto error_exit;
1994+ }
1995+
1996+ xcb->connection = XGetXCBConnection(xcb->display);
1997+ if (!xcb->connection)
1998+ {
1999+ geis_error("error connecting to X server.");
2000+ goto error_exit;
2001+ }
2002+
2003+ {
2004+ xcb_gesture_query_version_cookie_t version_cookie;
2005+ xcb_gesture_query_version_reply_t *version_reply = NULL;
2006+ xcb_generic_error_t *error = NULL;
2007+
2008+ version_cookie = xcb_gesture_query_version(xcb->connection,
2009+ XCB_GESTURE_MAJOR_VERSION,
2010+ XCB_GESTURE_MINOR_VERSION);
2011+ version_reply = xcb_gesture_query_version_reply(xcb->connection,
2012+ version_cookie,
2013+ &error);
2014+ if (!version_reply)
2015+ {
2016+ geis_error("failed to receive gesture version reply\n");
2017+ goto error_exit;
2018+ }
2019+
2020+ if (version_reply->major_version != XCB_GESTURE_MAJOR_VERSION
2021+ && version_reply->minor_version != XCB_GESTURE_MINOR_VERSION)
2022+ {
2023+ geis_error("server supports unrecognized version: %d.%d\n",
2024+ version_reply->major_version, version_reply->minor_version);
2025+ }
2026+
2027+ free(version_reply);
2028+ }
2029+
2030+
2031+ xcb->fd = xcb_get_file_descriptor(xcb->connection);
2032+ xcb->instance_table = geis_instance_table_new(1);
2033+ if (!xcb->instance_table)
2034+ {
2035+ geis_error("error constructing instance table");
2036+ goto error_exit;
2037+ }
2038+
2039+ goto final_exit;
2040+
2041+error_exit:
2042+ free(xcb);
2043+
2044+final_exit:
2045+ return xcb;
2046+}
2047+
2048+
2049+/**
2050+ * Create a new GeisInstance for a windowId.
2051+ *
2052+ * @param[in] An X11 windowId.
2053+ */
2054+GeisInstance
2055+geis_xcb_create_instance(GeisXcb xcb, uint32_t window_id)
2056+{
2057+ GeisInstance instance = geis_instance_new(window_id);
2058+ if (!instance)
2059+ {
2060+ geis_error("failure to create GeisInstance");
2061+ }
2062+ else
2063+ {
2064+ geis_instance_table_add(xcb->instance_table, instance);
2065+ }
2066+ return instance;
2067+}
2068+
2069+
2070+/**
2071+ * Gets the file description on which events will appear.
2072+ */
2073 int
2074-geis_xcb_fd(GeisXcb *xcb)
2075+geis_xcb_fd(GeisXcb xcb)
2076 {
2077- return xcb->fd;
2078+ return xcb->fd;
2079 }
2080
2081
2082+/**
2083+ * Dispatches events.
2084+ */
2085 void
2086-geis_xcb_dispatch(GeisInstance instance)
2087+geis_xcb_dispatch(GeisXcb xcb)
2088 {
2089- GeisXcb *xcb = instance->xcb;
2090 if (xcb->connection)
2091 {
2092 const xcb_query_extension_reply_t *extension_info;
2093@@ -528,27 +739,37 @@
2094 {
2095 xcb_gesture_notify_event_t *gesture_event = NULL;
2096 if (event->response_type != GenericEvent) {
2097- geis_debug("warning: Received non-generic event type: %d\n",
2098- event->response_type);
2099+ geis_warning("received non-generic event type: %d\n",
2100+ event->response_type);
2101 continue;
2102 }
2103
2104 gesture_event = (xcb_gesture_notify_event_t*)event;
2105 if (gesture_event->extension != extension_info->major_opcode)
2106 {
2107- geis_debug("warning: Received non-gesture extension event: %d\n",
2108- gesture_event->extension);
2109+ geis_warning("received non-gesture extension event: %d\n",
2110+ gesture_event->extension);
2111 continue;
2112 }
2113
2114 if (gesture_event->event_type != XCB_GESTURE_NOTIFY)
2115 {
2116- geis_debug("warning: Received unrecognized gesture event type: %d\n",
2117- gesture_event->event_type);
2118+ geis_warning("received unrecognized gesture event type: %d\n",
2119+ gesture_event->event_type);
2120 continue;
2121 }
2122
2123- geis_xcb_dispatch_gesture(instance, gesture_event);
2124+ GeisInstance instance = geis_instance_table_get(xcb->instance_table,
2125+ gesture_event->event);
2126+ if (!instance)
2127+ {
2128+ geis_error("no instance found for window_id 0x%08x\n",
2129+ gesture_event->event);
2130+ }
2131+ else
2132+ {
2133+ geis_xcb_dispatch_gesture(instance, gesture_event);
2134+ }
2135
2136 event = xcb_poll_for_event(xcb->connection);
2137 }
2138@@ -557,89 +778,183 @@
2139
2140
2141 void
2142-geis_xcb_free(GeisXcb* xcb)
2143+geis_xcb_free(GeisXcb xcb)
2144 {
2145 xcb_disconnect(xcb->connection);
2146+ XCloseDisplay(xcb->display);
2147+}
2148+
2149+
2150+static void
2151+geis_xcb_map_gestures_to_mask(const char **gesture_list,
2152+ uint32_t **gesture_mask,
2153+ uint32_t *gesture_mask_len)
2154+{
2155+ *gesture_mask_len = 1;
2156+ *gesture_mask = calloc(sizeof(uint32_t), *gesture_mask_len);
2157+ if (!gesture_mask)
2158+ return;
2159+
2160+ const char **g = gesture_list;
2161+ if (g == GEIS_ALL_GESTURES)
2162+ {
2163+ uint32_t all = 0xffffffff;
2164+ memcpy(*gesture_mask, &all, sizeof(uint32_t));
2165+ }
2166+ else
2167+ {
2168+ while (*g)
2169+ {
2170+ const GrailTypeMap *type = s_grail_type_map;
2171+ for (; type->name; ++type)
2172+ {
2173+ if (strcmp(type->name, *g) == 0)
2174+ {
2175+ if (type->type < 32)
2176+ {
2177+ **gesture_mask |= (1 << type->type);
2178+ }
2179+ break;
2180+ }
2181+ }
2182+ ++g;
2183+ }
2184+ }
2185+}
2186+
2187+
2188+static GeisStatus
2189+geis_xcb_verify_event_selection(GeisXcb xcb,
2190+ uint32_t window_id,
2191+ uint16_t device_id,
2192+ uint32_t mask_len,
2193+ uint32_t *mask)
2194+{
2195+ GeisStatus result = GEIS_UNKNOWN_ERROR;
2196+ xcb_generic_error_t *error;
2197+ xcb_gesture_get_selected_events_cookie_t events_cookie;
2198+ xcb_gesture_get_selected_events_reply_t *events_reply = NULL;
2199+ xcb_gesture_event_mask_iterator_t event_mask_it;
2200+ uint32_t mask_len_reply = 0;
2201+ uint32_t *mask_reply = NULL;
2202+ int device_is_found = 0;
2203+
2204+ events_cookie = xcb_gesture_get_selected_events(xcb->connection,
2205+ window_id);
2206+ events_reply = xcb_gesture_get_selected_events_reply(xcb->connection,
2207+ events_cookie,
2208+ &error);
2209+ if (!events_reply)
2210+ {
2211+ geis_error("failed to receive selected events reply\n");
2212+ goto really_done;
2213+ }
2214+
2215+ for (event_mask_it = xcb_gesture_get_selected_events_masks_iterator(events_reply);
2216+ event_mask_it.rem;
2217+ xcb_gesture_event_mask_next(&event_mask_it))
2218+ {
2219+ xcb_gesture_event_mask_t *event_mask = event_mask_it.data;
2220+ if (event_mask->device_id == device_id)
2221+ {
2222+ mask_len_reply = xcb_gesture_event_mask_mask_data_length(event_mask);
2223+ if (mask_len_reply != mask_len)
2224+ {
2225+ geis_error("incorrect mask length returned by server - expected %d, got %d\n",
2226+ mask_len, mask_len_reply);
2227+ goto done;
2228+ }
2229+
2230+ mask_reply = xcb_gesture_event_mask_mask_data(event_mask);
2231+ if (memcmp(mask, mask_reply, mask_len * 4) != 0)
2232+ {
2233+ geis_error("incorrect mask returned by server\n");
2234+ goto done;
2235+ }
2236+
2237+ device_is_found = 1;
2238+ }
2239+ }
2240+
2241+ if (!device_is_found)
2242+ {
2243+ geis_error("gesture mask for device %d not returned by server\n", device_id);
2244+ goto done;
2245+ }
2246+
2247+ result = GEIS_STATUS_SUCCESS;
2248+done:
2249+ free(events_reply);
2250+really_done:
2251+ return result;
2252 }
2253
2254
2255 GeisStatus
2256-geis_xcb_subscribe(GeisInstance instance,
2257+geis_xcb_subscribe(GeisXcb xcb,
2258+ GeisInstance instance,
2259+ uint16_t device_id,
2260 const char **gesture_list)
2261 {
2262- uint16_t device_id = 0; //< temporary for dev testing
2263- uint32_t mask_len = 1; //< temporary for dev testing
2264- uint32_t mask[] = { 0xffffffff }; //< temporary for dev testing
2265-
2266- xcb_generic_error_t *error;
2267- xcb_void_cookie_t select_cookie;
2268- GeisXcb *xcb = instance->xcb;
2269-
2270- geis_xcb_dispatch_gesture_type(instance, gesture_list);
2271+ GeisStatus result = GEIS_UNKNOWN_ERROR;
2272+ uint32_t mask_len = 1;
2273+ uint32_t *mask = 0;
2274+ const char **g;
2275+ xcb_generic_error_t *error;
2276+ xcb_void_cookie_t select_cookie;
2277+ xcb_window_t window_id = geis_instance_get_window_id(instance);
2278+
2279+ if (gesture_list == GEIS_ALL_GESTURES)
2280+ {
2281+ geis_debug("subscribing device %d for the all gestures\n", device_id);
2282+ }
2283+ else
2284+ {
2285+ geis_debug("subscribing device %d for the following gestures:\n", device_id);
2286+ for (g = gesture_list; *g; ++g)
2287+ {
2288+ geis_debug("\t\"%s\"\n", *g);
2289+ }
2290+ }
2291+
2292+ geis_xcb_map_gestures_to_mask(gesture_list, &mask, &mask_len);
2293+ if (!mask)
2294+ {
2295+ geis_error("failed to allocate mask\n");
2296+ goto really_done;
2297+ }
2298
2299 select_cookie = xcb_gesture_select_events_checked(xcb->connection,
2300- xcb->win_info->window_id,
2301- device_id,
2302- mask_len,
2303- mask);
2304+ window_id,
2305+ device_id,
2306+ mask_len,
2307+ mask);
2308 error = xcb_request_check(xcb->connection, select_cookie);
2309 if (error)
2310 {
2311- geis_debug("failed to select events\n");
2312- return GEIS_UNKNOWN_ERROR;
2313+ geis_error("failed to select events for window 0x%08x\n", window_id);
2314+ goto done;
2315 }
2316
2317+ result = geis_xcb_verify_event_selection(xcb, window_id, device_id, mask_len, mask);
2318+ if (result == GEIS_STATUS_SUCCESS)
2319 {
2320- xcb_gesture_get_selected_events_cookie_t events_cookie;
2321- xcb_gesture_get_selected_events_reply_t *events_reply = NULL;
2322- xcb_gesture_event_mask_iterator_t events_iterator;
2323- unsigned masks_len_reply = 0;
2324- unsigned mask_len_reply = 0;
2325- uint32_t *mask_reply;
2326-
2327- events_cookie = xcb_gesture_get_selected_events(xcb->connection,
2328- xcb->win_info->window_id);
2329- events_reply = xcb_gesture_get_selected_events_reply(xcb->connection,
2330- events_cookie,
2331- &error);
2332- if (!events_reply)
2333- {
2334- geis_debug("failed to receive selected events reply\n");
2335- return GEIS_UNKNOWN_ERROR;
2336- }
2337-
2338- masks_len_reply = xcb_gesture_get_selected_events_masks_length(events_reply);
2339- if (masks_len_reply != 1)
2340- {
2341- geis_debug("wrong selected masks length returned: %d\n", masks_len_reply);
2342- return GEIS_UNKNOWN_ERROR;
2343- }
2344-
2345- events_iterator = xcb_gesture_get_selected_events_masks_iterator(events_reply);
2346- if (events_iterator.data->device_id != device_id)
2347- {
2348- geis_debug("incorrect device id returned by server: %d\n",
2349- events_iterator.data->device_id);
2350- return GEIS_UNKNOWN_ERROR;
2351- }
2352-
2353- mask_len_reply = xcb_gesture_event_mask_mask_data_length(events_iterator.data);
2354- if (mask_len_reply != mask_len)
2355- {
2356- geis_debug("incorrect mask length returned by server: %d\n",
2357- mask_len_reply);
2358- return GEIS_UNKNOWN_ERROR;
2359- }
2360-
2361- mask_reply = xcb_gesture_event_mask_mask_data(events_iterator.data);
2362- if (memcmp(mask, mask_reply, mask_len * 4) != 0)
2363- {
2364- geis_debug("incorrect mask returned by server\n");
2365- return GEIS_UNKNOWN_ERROR;
2366- }
2367-
2368- free(events_reply);
2369+ geis_xcb_dispatch_gesture_type(instance, gesture_list);
2370 }
2371
2372+done:
2373+ free(mask);
2374+really_done:
2375+ return result;
2376+}
2377+
2378+
2379+GeisStatus
2380+geis_xcb_input_devices(GeisXcb xcb, GeisInputFuncs *funcs, void *cookie)
2381+{
2382+ xcb->input_funcs = funcs;
2383+ xcb->input_cookie = cookie;
2384 return GEIS_STATUS_SUCCESS;
2385 }
2386+
2387+
2388
2389=== modified file 'libutouch-geis-xcb/geis_xcb.h'
2390--- libutouch-geis-xcb/geis_xcb.h 2010-08-11 13:54:54 +0000
2391+++ libutouch-geis-xcb/geis_xcb.h 2010-09-16 16:28:52 +0000
2392@@ -4,18 +4,18 @@
2393 * Copyright 2010 Canonical Ltd.
2394 *
2395 * This library is free software; you can redistribute it and/or modify it under
2396- * the terms of the GNU Lesser General Public License as published by the Free Software
2397- * Foundation; either version 3 of the License, or (at your option) any later
2398- * version.
2399+ * the terms of the GNU Lesser General Public License as published by the Free
2400+ * Software Foundation; either version 3 of the License, or (at your option) any
2401+ * later version.
2402 *
2403 * This library is distributed in the hope that it will be useful, but WITHOUT
2404 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
2405- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
2406- * more details.
2407+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
2408+ * details.
2409 *
2410 * You should have received a copy of the GNU Lesser General Public License
2411- * along with this program; if not, write to the Free Software
2412- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2413+ * along with this program; if not, write to the Free Software Foundation, Inc.,
2414+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2415 */
2416 #ifndef GEIS_XCB_H_
2417 #define GEIS_XCB_H_
2418@@ -23,17 +23,25 @@
2419 #include "geis_config.h"
2420 #include <geis/geis.h>
2421
2422-typedef struct _GeisXcb GeisXcb;
2423-
2424-GeisXcb *geis_xcb_get(GeisXcbWinInfo *win_info);
2425-
2426-GeisStatus geis_xcb_subscribe(GeisInstance instance,
2427+typedef struct _GeisXcb *GeisXcb;
2428+
2429+GeisXcb geis_xcb_new(GeisXcbWinInfo *win_info);
2430+
2431+GeisInstance geis_xcb_create_instance(GeisXcb xcb, uint32_t window_id);
2432+
2433+GeisStatus geis_xcb_input_devices(GeisXcb xcb,
2434+ GeisInputFuncs *funcs,
2435+ void *cookie);
2436+
2437+GeisStatus geis_xcb_subscribe(GeisXcb xcb,
2438+ GeisInstance instance,
2439+ uint16_t device_id,
2440 const char **gesture_list);
2441
2442-int geis_xcb_fd(GeisXcb* xcb);
2443-
2444-void geis_xcb_dispatch(GeisInstance instance);
2445-
2446-void geis_xcb_free(GeisXcb *xcb);
2447+int geis_xcb_fd(GeisXcb xcb);
2448+
2449+void geis_xcb_dispatch(GeisXcb xcb);
2450+
2451+void geis_xcb_free(GeisXcb xcb);
2452
2453 #endif /* GEIS_XCB_H_ */
2454
2455=== modified file 'testsuite/Makefile.in'
2456--- testsuite/Makefile.in 2010-08-20 22:03:52 +0000
2457+++ testsuite/Makefile.in 2010-09-16 16:28:52 +0000
2458@@ -158,11 +158,15 @@
2459 SHELL = @SHELL@
2460 STRIP = @STRIP@
2461 VERSION = @VERSION@
2462+X11XCB_CFLAGS = @X11XCB_CFLAGS@
2463+X11XCB_LIBS = @X11XCB_LIBS@
2464 XCBINCLUDEDIR = @XCBINCLUDEDIR@
2465 XCBPROTO_XCBINCLUDEDIR = @XCBPROTO_XCBINCLUDEDIR@
2466 XCBPROTO_XCBPYTHONDIR = @XCBPROTO_XCBPYTHONDIR@
2467 XCB_CFLAGS = @XCB_CFLAGS@
2468 XCB_LIBS = @XCB_LIBS@
2469+XI2_CFLAGS = @XI2_CFLAGS@
2470+XI2_LIBS = @XI2_LIBS@
2471 abs_builddir = @abs_builddir@
2472 abs_srcdir = @abs_srcdir@
2473 abs_top_builddir = @abs_top_builddir@
2474
2475=== modified file 'testsuite/geistest/Makefile.in'
2476--- testsuite/geistest/Makefile.in 2010-08-20 22:03:52 +0000
2477+++ testsuite/geistest/Makefile.in 2010-09-16 16:28:52 +0000
2478@@ -141,11 +141,15 @@
2479 SHELL = @SHELL@
2480 STRIP = @STRIP@
2481 VERSION = @VERSION@
2482+X11XCB_CFLAGS = @X11XCB_CFLAGS@
2483+X11XCB_LIBS = @X11XCB_LIBS@
2484 XCBINCLUDEDIR = @XCBINCLUDEDIR@
2485 XCBPROTO_XCBINCLUDEDIR = @XCBPROTO_XCBINCLUDEDIR@
2486 XCBPROTO_XCBPYTHONDIR = @XCBPROTO_XCBPYTHONDIR@
2487 XCB_CFLAGS = @XCB_CFLAGS@
2488 XCB_LIBS = @XCB_LIBS@
2489+XI2_CFLAGS = @XI2_CFLAGS@
2490+XI2_LIBS = @XI2_LIBS@
2491 abs_builddir = @abs_builddir@
2492 abs_srcdir = @abs_srcdir@
2493 abs_top_builddir = @abs_top_builddir@
2494
2495=== modified file 'testsuite/geistest/geistest.c'
2496--- testsuite/geistest/geistest.c 2010-08-11 13:54:54 +0000
2497+++ testsuite/geistest/geistest.c 2010-09-16 16:28:52 +0000
2498@@ -23,6 +23,8 @@
2499 #include <stdlib.h>
2500 #include <string.h>
2501 #include <sys/select.h>
2502+#include <unistd.h>
2503+#include <xcb/xcb.h>
2504
2505
2506 static void
2507@@ -51,6 +53,24 @@
2508
2509
2510 static void
2511+input_device_added(void *cookie, GeisInputDeviceId device_id, void *attrs)
2512+{
2513+}
2514+
2515+
2516+static void
2517+input_device_changed(void *cookie, GeisInputDeviceId device_id, void *attrs)
2518+{
2519+}
2520+
2521+
2522+static void
2523+input_device_removed(void *cookie, GeisInputDeviceId device_id, void *attrs)
2524+{
2525+}
2526+
2527+
2528+static void
2529 gesture_added(void *cookie,
2530 GeisGestureType gesture_type,
2531 GeisGestureId gesture_id,
2532@@ -116,6 +136,12 @@
2533 }
2534
2535
2536+GeisInputFuncs input_funcs = {
2537+ input_device_added,
2538+ input_device_changed,
2539+ input_device_removed
2540+};
2541+
2542 GeisGestureFuncs gesture_funcs = {
2543 gesture_added,
2544 gesture_removed,
2545@@ -128,22 +154,33 @@
2546 int
2547 parse_opts(int argc, char* argv[], uint32_t *window_id)
2548 {
2549- if (argc != 2)
2550- return 0;
2551-
2552- *window_id = strtol(argv[1], NULL, 0);
2553+ int opt;
2554+
2555+ while ((opt = getopt(argc, argv, "w:")) != -1)
2556+ {
2557+ switch (opt)
2558+ {
2559+ case 'w':
2560+ *window_id = strtol(optarg, NULL, 0);
2561+ break;
2562+
2563+ default:
2564+ return 0;
2565+ }
2566+ }
2567+
2568 return 1;
2569 }
2570
2571
2572-int
2573-main(int argc, char* argv[])
2574+static GeisInstance
2575+subscribe_window(uint32_t window_id)
2576 {
2577 GeisStatus status = GEIS_UNKNOWN_ERROR;
2578 GeisXcbWinInfo xcb_win_info = {
2579 .display_name = NULL,
2580 .screenp = NULL,
2581- .window_id = 0x296
2582+ .window_id = window_id
2583 };
2584 GeisWinInfo win_info = {
2585 GEIS_XCB_FULL_WINDOW,
2586@@ -151,32 +188,18 @@
2587 };
2588 GeisInstance instance;
2589
2590- if (!parse_opts(argc, argv, &xcb_win_info.window_id))
2591- {
2592- fprintf(stderr, "usage: %s windowid\n", argv[0]);
2593- return -1;
2594- }
2595-
2596 status = geis_init(&win_info, &instance);
2597 if (status != GEIS_STATUS_SUCCESS)
2598 {
2599 fprintf(stderr, "error in geis_init\n");
2600- return 1;
2601- }
2602-
2603- status = geis_configuration_supported(instance, GEIS_CONFIG_UNIX_FD);
2604- if (status != GEIS_STATUS_SUCCESS)
2605- {
2606- fprintf(stderr, "GEIS does not support Unix fd\n");
2607- return 1;
2608- }
2609-
2610- int fd = -1;
2611- status = geis_configuration_get_value(instance, GEIS_CONFIG_UNIX_FD, &fd);
2612- if (status != GEIS_STATUS_SUCCESS)
2613- {
2614- fprintf(stderr, "error retrieving GEIS fd\n");
2615- return 1;
2616+ return NULL;
2617+ }
2618+
2619+ status = geis_input_devices(instance, &input_funcs, NULL);
2620+ if (status != GEIS_STATUS_SUCCESS)
2621+ {
2622+ fprintf(stderr, "error subscribing to input devices\n");
2623+ return NULL;
2624 }
2625
2626 status = geis_subscribe(instance,
2627@@ -187,7 +210,155 @@
2628 if (status != GEIS_STATUS_SUCCESS)
2629 {
2630 fprintf(stderr, "error subscribing to gestures\n");
2631- return 1;
2632+ return NULL;
2633+ }
2634+
2635+ return instance;
2636+}
2637+
2638+
2639+static size_t
2640+subscribe_windows_preorder(xcb_connection_t *xcb,
2641+ xcb_window_t window,
2642+ size_t instance_table_size,
2643+ GeisInstance **instance_table)
2644+{
2645+ ++instance_table_size;
2646+ GeisInstance *new_instance_table;
2647+ new_instance_table = realloc(*instance_table,
2648+ instance_table_size * sizeof(GeisInstance));
2649+ new_instance_table[instance_table_size-1] = subscribe_window(window);
2650+ if (!new_instance_table[instance_table_size-1])
2651+ {
2652+ fprintf(stderr, "error creating geis instance for window 0x%08x\n", window);
2653+ free(new_instance_table);
2654+ instance_table_size = 0;
2655+ goto error_exit;
2656+ }
2657+
2658+ xcb_generic_error_t *error;
2659+ xcb_query_tree_cookie_t tree_cookie = xcb_query_tree(xcb, window);
2660+ xcb_query_tree_reply_t *tree_reply = xcb_query_tree_reply(xcb,
2661+ tree_cookie,
2662+ &error);
2663+ if (!tree_reply)
2664+ {
2665+ fprintf(stderr, "failed to query tree for window 0x%x\n", window);
2666+ goto error_exit;
2667+ }
2668+
2669+ int num_children = xcb_query_tree_children_length(tree_reply);
2670+ if (num_children <= 0)
2671+ goto tree_exit;
2672+
2673+ xcb_window_t *children = xcb_query_tree_children(tree_reply);
2674+ if (!children)
2675+ {
2676+ fprintf(stderr, "failed to retrieve children of window 0x%x\n", window);
2677+ goto tree_exit;
2678+ }
2679+
2680+ int i;
2681+ for (i = 0; i < num_children; i++)
2682+ {
2683+ instance_table_size = subscribe_windows_preorder(xcb,
2684+ children[i],
2685+ instance_table_size,
2686+ &new_instance_table);
2687+ if (instance_table_size == 0)
2688+ break;
2689+ }
2690+
2691+tree_exit:
2692+ free(tree_reply);
2693+error_exit:
2694+ *instance_table = new_instance_table;
2695+ return instance_table_size;
2696+}
2697+
2698+
2699+static size_t
2700+subscribe_all_windows(GeisInstance **instance_table)
2701+{
2702+ int instance_table_size = 0;
2703+
2704+ xcb_connection_t *xcb = xcb_connect(NULL, NULL);
2705+ if (!xcb) {
2706+ fprintf(stderr, "error connecting to X server\n");
2707+ return -1;
2708+ }
2709+
2710+ const xcb_setup_t *setup = xcb_get_setup(xcb);
2711+ if (!setup)
2712+ {
2713+ fprintf(stderr, "error getting xcb setup\n");
2714+ return -1;
2715+ }
2716+
2717+ xcb_screen_iterator_t screen = xcb_setup_roots_iterator(setup);
2718+ while (screen.rem)
2719+ {
2720+ instance_table_size = subscribe_windows_preorder(xcb,
2721+ screen.data->root,
2722+ instance_table_size,
2723+ instance_table);
2724+
2725+ xcb_screen_next(&screen);
2726+ }
2727+
2728+ xcb_disconnect(xcb);
2729+ return instance_table_size;
2730+}
2731+
2732+int
2733+main(int argc, char* argv[])
2734+{
2735+ int result = -1;
2736+ uint32_t window_id = 0;
2737+ int fd = -1;
2738+ GeisStatus status = GEIS_UNKNOWN_ERROR;
2739+ GeisInstance *instance_table = NULL;
2740+ size_t instance_table_size = 0;
2741+
2742+ if (!parse_opts(argc, argv, &window_id))
2743+ {
2744+ fprintf(stderr, "usage: %s windowid\n", argv[0]);
2745+ return -1;
2746+ }
2747+
2748+ if (window_id != 0)
2749+ {
2750+ instance_table_size = 1;
2751+ instance_table = calloc(instance_table_size, sizeof(GeisInstance));
2752+ instance_table[0] = subscribe_window(window_id);
2753+ if (!instance_table[0])
2754+ {
2755+ fprintf(stderr, "can not continue, exiting....\n");
2756+ goto error_exit;
2757+ }
2758+ }
2759+ else
2760+ {
2761+ instance_table_size = subscribe_all_windows(&instance_table);
2762+ if (instance_table_size == 0)
2763+ {
2764+ fprintf(stderr, "can not continue, exiting....\n");
2765+ goto error_exit;
2766+ }
2767+ }
2768+
2769+ status = geis_configuration_supported(instance_table[0], GEIS_CONFIG_UNIX_FD);
2770+ if (status != GEIS_STATUS_SUCCESS)
2771+ {
2772+ fprintf(stderr, "GEIS does not support Unix fd\n");
2773+ goto fail_exit;
2774+ }
2775+
2776+ status = geis_configuration_get_value(instance_table[0], GEIS_CONFIG_UNIX_FD, &fd);
2777+ if (status != GEIS_STATUS_SUCCESS)
2778+ {
2779+ fprintf(stderr, "error retrieving GEIS fd\n");
2780+ goto fail_exit;
2781 }
2782
2783 while(1)
2784@@ -204,10 +375,24 @@
2785
2786 if (FD_ISSET(fd, &read_fds))
2787 {
2788- geis_event_dispatch(instance);
2789- }
2790- }
2791-
2792- geis_finish(instance);
2793+ geis_event_dispatch(instance_table[0]);
2794+ }
2795+ }
2796+
2797+fail_exit:
2798+ {
2799+ int i;
2800+ for (i = 0; i < instance_table_size; ++i)
2801+ {
2802+ geis_finish(instance_table[i]);
2803+ }
2804+ }
2805+
2806+error_exit:
2807+ if (instance_table_size > 0)
2808+ {
2809+ free(instance_table);
2810+ }
2811+ return result;
2812 }
2813

Subscribers

People subscribed via source and target branches