Merge lp:~oif-packaging/frame/ubuntu.v1.1.0 into lp:frame/ubuntu

Proposed by Henrik Rydberg
Status: Merged
Merged at revision: 18
Proposed branch: lp:~oif-packaging/frame/ubuntu.v1.1.0
Merge into: lp:frame/ubuntu
Diff against target: 2285 lines (+1406/-156)
24 files modified
ChangeLog (+211/-0)
Makefile.in (+3/-0)
configure (+150/-26)
configure.ac (+9/-2)
debian/changelog (+7/-0)
debian/libutouch-frame1.symbols (+3/-0)
include/utouch/frame-mtdev.h (+8/-0)
include/utouch/frame-xi2.h (+49/-0)
include/utouch/frame.h (+61/-6)
src/Makefile.am (+9/-1)
src/Makefile.in (+25/-19)
src/frame-impl.h (+2/-1)
src/frame-mtdev.c (+39/-14)
src/frame-xi2.c (+322/-0)
src/frame.c (+80/-7)
test/Makefile.in (+3/-0)
tools/Makefile.am (+19/-3)
tools/Makefile.in (+36/-6)
tools/common-defs.h (+85/-0)
tools/utouch-frame-test-mtdev.1 (+42/-0)
tools/utouch-frame-test-mtdev.c (+2/-71)
tools/utouch-frame-test-xi2.1 (+42/-0)
tools/utouch-frame-test-xi2.c (+177/-0)
tools/utouch-frame-test-xi2.txt (+22/-0)
To merge this branch: bzr merge lp:~oif-packaging/frame/ubuntu.v1.1.0
Reviewer Review Type Date Requested Status
Chase Douglas (community) Approve
Review via email: mp+50911@code.launchpad.net

Description of the change

This package contains upgrade to v1.1.0, containing abi-compatible api extentions needed for development during natty. All current code compiles well with this package. A built package is available in ppa:utouch-team/unstable.

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

Looks good to me.

review: Approve
18. By Henrik Rydberg

Updating symbols file with api additions

Revision history for this message
Henrik Rydberg (rydberg) wrote :

The new symbols compiled fine, so merged.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog'
2--- ChangeLog 2010-12-30 19:26:42 +0000
3+++ ChangeLog 2011-02-23 14:02:38 +0000
4@@ -1,5 +1,214 @@
5 ------------------------------------------------------------
6+revno: 24
7+committer: Henrik Rydberg <rydberg@bitmath.org>
8+branch nick: trunk
9+timestamp: Wed 2011-02-23 12:37:53 +0100
10+message:
11+ Release version 1.1.0
12+
13+ With this release, the (ABI-stable) API additions are official.
14+------------------------------------------------------------
15+revno: 23
16+tags: v1.0.4
17+committer: Henrik Rydberg <rydberg@bitmath.org>
18+branch nick: trunk
19+timestamp: Wed 2011-02-23 12:06:36 +0100
20+message:
21+ Bump to version 1.0.4
22+------------------------------------------------------------
23+revno: 22
24+committer: Henrik Rydberg <rydberg@bitmath.org>
25+branch nick: trunk
26+timestamp: Wed 2011-02-23 12:06:09 +0100
27+message:
28+ Add missing manpage source to tarball
29+
30+ The .txt files where missing from the tarball, such that the
31+ manpage could not be regenerated.
32+------------------------------------------------------------
33+revno: 21
34+tags: v1.0.3
35+committer: Henrik Rydberg <rydberg@bitmath.org>
36+branch nick: trunk
37+timestamp: Wed 2011-02-23 11:03:51 +0100
38+message:
39+ Bump to version 1.0.3
40+------------------------------------------------------------
41+revno: 20
42+committer: Henrik Rydberg <rydberg@bitmath.org>
43+branch nick: trunk
44+timestamp: Wed 2011-02-23 11:03:28 +0100
45+message:
46+ Ignore generated xi2 binary and manpage
47+------------------------------------------------------------
48+revno: 19
49+committer: Henrik Rydberg <rydberg@bitmath.org>
50+branch nick: trunk
51+timestamp: Wed 2011-02-23 11:02:52 +0100
52+message:
53+ Generate manpage also for the optional xi2 configuration
54+------------------------------------------------------------
55+revno: 18
56+tags: v1.0.2
57+committer: Henrik Rydberg <rydberg@bitmath.org>
58+branch nick: trunk
59+timestamp: Tue 2011-02-22 16:32:16 +0100
60+message:
61+ Bump to version 1.0.2
62+------------------------------------------------------------
63+revno: 17
64+committer: Henrik Rydberg <rydberg@bitmath.org>
65+branch nick: trunk
66+timestamp: Tue 2011-02-22 16:32:00 +0100
67+message:
68+ Disable time-dependent filtering for current XI2.1
69+
70+ Velocity-adjusted positioning and Kalman filters depend on accurate
71+ time stamps on events. Until we have device event times, disable this
72+ functionality for XI2.1
73+------------------------------------------------------------
74+revno: 16
75+committer: Henrik Rydberg <rydberg@bitmath.org>
76+branch nick: trunk
77+timestamp: Tue 2011-02-22 15:53:42 +0100
78+message:
79+ Fix ABS_MT_DISTANCE compilation conditional
80+
81+ The ABS_MT_DISTANCE is new, and the corresponding entry in
82+ xserver-properties.h is even newer. Make compilation conditional on
83+ the existence of those two defines.
84+------------------------------------------------------------
85+revno: 15
86+committer: Henrik Rydberg <rydberg@bitmath.org>
87+branch nick: trunk
88+timestamp: Tue 2011-02-22 15:53:21 +0100
89+message:
90+ Simplify XInput package test
91+
92+ The XI2.1 support is present in sufficiently recent xinput packages,
93+ so simplify the testing accordingly.
94+------------------------------------------------------------
95+revno: 14
96+committer: Henrik Rydberg <rydberg@bitmath.org>
97+branch nick: trunk
98+timestamp: Mon 2011-02-21 13:16:19 +0100
99+message:
100+ Adjust to xi2 api changes
101+
102+ The touch event types have new names since February 2011. Modify
103+ accordingly.
104+------------------------------------------------------------
105+revno: 13
106+committer: Henrik Rydberg <rydberg@bitmath.org>
107+branch nick: trunk
108+timestamp: Mon 2011-02-21 13:16:00 +0100
109+message:
110+ Add functions to extract number of frames and slots
111+------------------------------------------------------------
112+revno: 12
113+committer: Henrik Rydberg <rydberg@bitmath.org>
114+branch nick: trunk
115+timestamp: Mon 2011-02-21 13:15:30 +0100
116+message:
117+ Add velocity estimate
118+
119+ The per-touch velocity is useful in many contexts. This patch
120+ adds a simple estimator of the velocity, which also smooths out
121+ position jumps caused by course-grained event updates.
122+------------------------------------------------------------
123+revno: 11
124+committer: Henrik Rydberg <rydberg@bitmath.org>
125+branch nick: trunk
126+timestamp: Mon 2011-02-21 13:15:13 +0100
127+message:
128+ Break out common display functions
129+------------------------------------------------------------
130+revno: 10
131+tags: v1.0.1
132+committer: Henrik Rydberg <rydberg@bitmath.org>
133+branch nick: trunk
134+timestamp: Tue 2011-02-15 15:06:12 +0100
135+message:
136+ Bump to v1.0.1
137+------------------------------------------------------------
138+revno: 9
139+committer: Henrik Rydberg <rydberg@bitmath.org>
140+branch nick: trunk
141+timestamp: Tue 2011-02-15 15:01:51 +0100
142+message:
143+ Optional XI2.1 support
144+
145+ This patchs adds optional XI2.1 support to utouch-frame. The
146+ utouch/frame-xi2.h header contains helper functions equivalent
147+ to utouch/frame-mtdev.h. In addition, the device-to-screen mapping
148+ is handled via XEvents and optionally XIPropertyEvent. The latter
149+ allows free device placement via xinput set-prop, useful in multi-
150+ head setups, thanks to Chase Douglas. Touch frame events can be tested
151+ using the utouch-frame-test-xi2 tool. Use --with-xi to enable.
152+------------------------------------------------------------
153+revno: 8
154+committer: Henrik Rydberg <rydberg@bitmath.org>
155+branch nick: trunk
156+timestamp: Tue 2011-02-15 15:01:01 +0100
157+message:
158+ Fix makefile oops
159+------------------------------------------------------------
160+revno: 7
161+committer: Henrik Rydberg <rydberg@bitmath.org>
162+branch nick: trunk
163+timestamp: Tue 2011-02-15 15:00:42 +0100
164+message:
165+ Add set slot by touch id utility
166+------------------------------------------------------------
167+revno: 6
168+committer: Henrik Rydberg <rydberg@bitmath.org>
169+branch nick: trunk
170+timestamp: Tue 2011-02-15 15:00:12 +0100
171+message:
172+ Map device coordinates onto target surface
173+
174+ The current implementation outputs most touch attributes in device
175+ coordinates. However, the primary use case is to map the input device
176+ onto an area on the screen, needed in particular for multihead setups.
177+ Moreover, the XI2.1 backend works with screen coordinates, creating
178+ an unnecessary discrepancy between backends. This patch adds the basic
179+ transformation layer to the utouch surface, thus serving as the master
180+ point of device-to-surface mapping.
181+------------------------------------------------------------
182+revno: 5
183+committer: Henrik Rydberg <rydberg@bitmath.org>
184+branch nick: trunk
185+timestamp: Tue 2011-02-15 14:59:40 +0100
186+message:
187+ Add C++ header integration
188+------------------------------------------------------------
189+revno: 4
190+committer: Henrik Rydberg <rydberg@bitmath.org>
191+branch nick: trunk
192+timestamp: Tue 2011-02-08 19:28:09 +0100
193+message:
194+ Display device properties based on utouch surface instead
195+
196+ The current code erroneously extracts the device properties from
197+ the evemu device, when there is a utouch surface structure to read
198+ from. Remedied.
199+------------------------------------------------------------
200+revno: 3
201+committer: Henrik Rydberg <rydberg@bitmath.org>
202+branch nick: trunk
203+timestamp: Tue 2011-02-08 19:24:27 +0100
204+message:
205+ Setup device properties based on udev heuristic for non-property devices
206+------------------------------------------------------------
207+revno: 2 [merge]
208+committer: Stephen M. Webb <stephen.webb@canonical.com>
209+branch nick: utouch-frame
210+timestamp: Thu 2011-02-03 13:39:08 -0500
211+message:
212+ Changes required for uploading into Ubuntu.
213+------------------------------------------------------------
214 revno: 1
215+tags: v1.0.0
216 committer: Henrik Rydberg <rydberg@bitmath.org>
217 branch nick: trunk
218 timestamp: Thu 2010-12-30 20:23:24 +0100
219@@ -7,3 +216,5 @@
220 Initial load of utouch-frame
221
222 Compiles and runs on mtdev. ABI proof.
223+------------------------------------------------------------
224+Use --include-merges or -n0 to see merged revisions.
225
226=== modified file 'Makefile.in'
227--- Makefile.in 2010-12-30 19:26:42 +0000
228+++ Makefile.in 2011-02-23 14:02:38 +0000
229@@ -130,6 +130,7 @@
230 ACLOCAL = @ACLOCAL@
231 AMTAR = @AMTAR@
232 AR = @AR@
233+ASCIIDOC = @ASCIIDOC@
234 AUTOCONF = @AUTOCONF@
235 AUTOHEADER = @AUTOHEADER@
236 AUTOMAKE = @AUTOMAKE@
237@@ -195,6 +196,8 @@
238 SHELL = @SHELL@
239 STRIP = @STRIP@
240 VERSION = @VERSION@
241+XINPUT_CFLAGS = @XINPUT_CFLAGS@
242+XINPUT_LIBS = @XINPUT_LIBS@
243 abs_builddir = @abs_builddir@
244 abs_srcdir = @abs_srcdir@
245 abs_top_builddir = @abs_top_builddir@
246
247=== modified file 'configure'
248--- configure 2011-02-03 19:22:55 +0000
249+++ configure 2011-02-23 14:02:38 +0000
250@@ -1,6 +1,6 @@
251 #! /bin/sh
252 # Guess values for system-dependent variables and create Makefiles.
253-# Generated by GNU Autoconf 2.67 for Touch Frame Library 1.0.0.
254+# Generated by GNU Autoconf 2.67 for Touch Frame Library 1.1.0.
255 #
256 #
257 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
258@@ -698,8 +698,8 @@
259 # Identity of this package.
260 PACKAGE_NAME='Touch Frame Library'
261 PACKAGE_TARNAME='utouch-frame'
262-PACKAGE_VERSION='1.0.0'
263-PACKAGE_STRING='Touch Frame Library 1.0.0'
264+PACKAGE_VERSION='1.1.0'
265+PACKAGE_STRING='Touch Frame Library 1.1.0'
266 PACKAGE_BUGREPORT=''
267 PACKAGE_URL=''
268
269@@ -747,6 +747,10 @@
270 HAVE_DOCTOOLS_FALSE
271 HAVE_DOCTOOLS_TRUE
272 ASCIIDOC
273+XINPUT_LIBS
274+XINPUT_CFLAGS
275+HAVE_XI_FALSE
276+HAVE_XI_TRUE
277 EVEMU_LIBS
278 EVEMU_CFLAGS
279 MTDEV_LIBS
280@@ -874,6 +878,7 @@
281 enable_dependency_tracking
282 with_gnu_ld
283 enable_libtool_lock
284+with_xi
285 '
286 ac_precious_vars='build_alias
287 host_alias
288@@ -890,7 +895,9 @@
289 MTDEV_CFLAGS
290 MTDEV_LIBS
291 EVEMU_CFLAGS
292-EVEMU_LIBS'
293+EVEMU_LIBS
294+XINPUT_CFLAGS
295+XINPUT_LIBS'
296
297
298 # Initialize some variables set by options.
299@@ -1433,7 +1440,7 @@
300 # Omit some internal or obsolete options to make the list less imposing.
301 # This message is too long to be a string in the A/UX 3.1 sh.
302 cat <<_ACEOF
303-\`configure' configures Touch Frame Library 1.0.0 to adapt to many kinds of systems.
304+\`configure' configures Touch Frame Library 1.1.0 to adapt to many kinds of systems.
305
306 Usage: $0 [OPTION]... [VAR=VALUE]...
307
308@@ -1503,7 +1510,7 @@
309
310 if test -n "$ac_init_help"; then
311 case $ac_init_help in
312- short | recursive ) echo "Configuration of Touch Frame Library 1.0.0:";;
313+ short | recursive ) echo "Configuration of Touch Frame Library 1.1.0:";;
314 esac
315 cat <<\_ACEOF
316
317@@ -1527,6 +1534,7 @@
318 --with-pic try to use only PIC/non-PIC objects [default=use
319 both]
320 --with-gnu-ld assume the C compiler uses GNU ld [default=no]
321+ --with-xi Build with XI2.1 support
322
323 Some influential environment variables:
324 CC C compiler command
325@@ -1548,6 +1556,9 @@
326 EVEMU_CFLAGS
327 C compiler flags for EVEMU, overriding pkg-config
328 EVEMU_LIBS linker flags for EVEMU, overriding pkg-config
329+ XINPUT_CFLAGS
330+ C compiler flags for XINPUT, overriding pkg-config
331+ XINPUT_LIBS linker flags for XINPUT, overriding pkg-config
332
333 Use these variables to override the choices made by `configure' or to help
334 it to find libraries and programs with nonstandard names/locations.
335@@ -1615,7 +1626,7 @@
336 test -n "$ac_init_help" && exit $ac_status
337 if $ac_init_version; then
338 cat <<\_ACEOF
339-Touch Frame Library configure 1.0.0
340+Touch Frame Library configure 1.1.0
341 generated by GNU Autoconf 2.67
342
343 Copyright (C) 2010 Free Software Foundation, Inc.
344@@ -1893,7 +1904,7 @@
345 This file contains any messages produced by compilers while
346 running configure, to aid debugging if configure makes a mistake.
347
348-It was created by Touch Frame Library $as_me 1.0.0, which was
349+It was created by Touch Frame Library $as_me 1.1.0, which was
350 generated by GNU Autoconf 2.67. Invocation command line was
351
352 $ $0 $@
353@@ -2713,7 +2724,7 @@
354
355 # Define the identity of the package.
356 PACKAGE='utouch-frame'
357- VERSION='1.0.0'
358+ VERSION='1.1.0'
359
360
361 cat >>confdefs.h <<_ACEOF
362@@ -2777,7 +2788,7 @@
363
364
365
366-LIB_VERSION=1:0:0
367+LIB_VERSION=2:0:1
368
369
370 # Initialize libtool
371@@ -4440,13 +4451,13 @@
372 else
373 lt_cv_nm_interface="BSD nm"
374 echo "int some_variable = 0;" > conftest.$ac_ext
375- (eval echo "\"\$as_me:4443: $ac_compile\"" >&5)
376+ (eval echo "\"\$as_me:4454: $ac_compile\"" >&5)
377 (eval "$ac_compile" 2>conftest.err)
378 cat conftest.err >&5
379- (eval echo "\"\$as_me:4446: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
380+ (eval echo "\"\$as_me:4457: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
381 (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
382 cat conftest.err >&5
383- (eval echo "\"\$as_me:4449: output\"" >&5)
384+ (eval echo "\"\$as_me:4460: output\"" >&5)
385 cat conftest.out >&5
386 if $GREP 'External.*some_variable' conftest.out > /dev/null; then
387 lt_cv_nm_interface="MS dumpbin"
388@@ -5652,7 +5663,7 @@
389 ;;
390 *-*-irix6*)
391 # Find out which ABI we are using.
392- echo '#line 5655 "configure"' > conftest.$ac_ext
393+ echo '#line 5666 "configure"' > conftest.$ac_ext
394 if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
395 (eval $ac_compile) 2>&5
396 ac_status=$?
397@@ -7177,11 +7188,11 @@
398 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
399 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
400 -e 's:$: $lt_compiler_flag:'`
401- (eval echo "\"\$as_me:7180: $lt_compile\"" >&5)
402+ (eval echo "\"\$as_me:7191: $lt_compile\"" >&5)
403 (eval "$lt_compile" 2>conftest.err)
404 ac_status=$?
405 cat conftest.err >&5
406- echo "$as_me:7184: \$? = $ac_status" >&5
407+ echo "$as_me:7195: \$? = $ac_status" >&5
408 if (exit $ac_status) && test -s "$ac_outfile"; then
409 # The compiler can only warn and ignore the option if not recognized
410 # So say no if there are warnings other than the usual output.
411@@ -7516,11 +7527,11 @@
412 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
413 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
414 -e 's:$: $lt_compiler_flag:'`
415- (eval echo "\"\$as_me:7519: $lt_compile\"" >&5)
416+ (eval echo "\"\$as_me:7530: $lt_compile\"" >&5)
417 (eval "$lt_compile" 2>conftest.err)
418 ac_status=$?
419 cat conftest.err >&5
420- echo "$as_me:7523: \$? = $ac_status" >&5
421+ echo "$as_me:7534: \$? = $ac_status" >&5
422 if (exit $ac_status) && test -s "$ac_outfile"; then
423 # The compiler can only warn and ignore the option if not recognized
424 # So say no if there are warnings other than the usual output.
425@@ -7621,11 +7632,11 @@
426 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
427 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
428 -e 's:$: $lt_compiler_flag:'`
429- (eval echo "\"\$as_me:7624: $lt_compile\"" >&5)
430+ (eval echo "\"\$as_me:7635: $lt_compile\"" >&5)
431 (eval "$lt_compile" 2>out/conftest.err)
432 ac_status=$?
433 cat out/conftest.err >&5
434- echo "$as_me:7628: \$? = $ac_status" >&5
435+ echo "$as_me:7639: \$? = $ac_status" >&5
436 if (exit $ac_status) && test -s out/conftest2.$ac_objext
437 then
438 # The compiler can only warn and ignore the option if not recognized
439@@ -7676,11 +7687,11 @@
440 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
441 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
442 -e 's:$: $lt_compiler_flag:'`
443- (eval echo "\"\$as_me:7679: $lt_compile\"" >&5)
444+ (eval echo "\"\$as_me:7690: $lt_compile\"" >&5)
445 (eval "$lt_compile" 2>out/conftest.err)
446 ac_status=$?
447 cat out/conftest.err >&5
448- echo "$as_me:7683: \$? = $ac_status" >&5
449+ echo "$as_me:7694: \$? = $ac_status" >&5
450 if (exit $ac_status) && test -s out/conftest2.$ac_objext
451 then
452 # The compiler can only warn and ignore the option if not recognized
453@@ -10060,7 +10071,7 @@
454 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
455 lt_status=$lt_dlunknown
456 cat > conftest.$ac_ext <<_LT_EOF
457-#line 10063 "configure"
458+#line 10074 "configure"
459 #include "confdefs.h"
460
461 #if HAVE_DLFCN_H
462@@ -10156,7 +10167,7 @@
463 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
464 lt_status=$lt_dlunknown
465 cat > conftest.$ac_ext <<_LT_EOF
466-#line 10159 "configure"
467+#line 10170 "configure"
468 #include "confdefs.h"
469
470 #if HAVE_DLFCN_H
471@@ -11352,6 +11363,115 @@
472
473 fi
474
475+
476+# Check whether --with-xi was given.
477+if test "${with_xi+set}" = set; then :
478+ withval=$with_xi;
479+fi
480+
481+ if test "x$with_xi" != "x"; then
482+ HAVE_XI_TRUE=
483+ HAVE_XI_FALSE='#'
484+else
485+ HAVE_XI_TRUE='#'
486+ HAVE_XI_FALSE=
487+fi
488+
489+
490+if test "x$with_xi" = "xyes"; then :
491+
492+
493+pkg_failed=no
494+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XINPUT" >&5
495+$as_echo_n "checking for XINPUT... " >&6; }
496+
497+if test -n "$XINPUT_CFLAGS"; then
498+ pkg_cv_XINPUT_CFLAGS="$XINPUT_CFLAGS"
499+ elif test -n "$PKG_CONFIG"; then
500+ if test -n "$PKG_CONFIG" && \
501+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"x11 xext xi >= 1.4.1.99.1 inputproto >= 2.0.99.1\""; } >&5
502+ ($PKG_CONFIG --exists --print-errors "x11 xext xi >= 1.4.1.99.1 inputproto >= 2.0.99.1") 2>&5
503+ ac_status=$?
504+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
505+ test $ac_status = 0; }; then
506+ pkg_cv_XINPUT_CFLAGS=`$PKG_CONFIG --cflags "x11 xext xi >= 1.4.1.99.1 inputproto >= 2.0.99.1" 2>/dev/null`
507+else
508+ pkg_failed=yes
509+fi
510+ else
511+ pkg_failed=untried
512+fi
513+if test -n "$XINPUT_LIBS"; then
514+ pkg_cv_XINPUT_LIBS="$XINPUT_LIBS"
515+ elif test -n "$PKG_CONFIG"; then
516+ if test -n "$PKG_CONFIG" && \
517+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"x11 xext xi >= 1.4.1.99.1 inputproto >= 2.0.99.1\""; } >&5
518+ ($PKG_CONFIG --exists --print-errors "x11 xext xi >= 1.4.1.99.1 inputproto >= 2.0.99.1") 2>&5
519+ ac_status=$?
520+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
521+ test $ac_status = 0; }; then
522+ pkg_cv_XINPUT_LIBS=`$PKG_CONFIG --libs "x11 xext xi >= 1.4.1.99.1 inputproto >= 2.0.99.1" 2>/dev/null`
523+else
524+ pkg_failed=yes
525+fi
526+ else
527+ pkg_failed=untried
528+fi
529+
530+
531+
532+if test $pkg_failed = yes; then
533+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
534+$as_echo "no" >&6; }
535+
536+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
537+ _pkg_short_errors_supported=yes
538+else
539+ _pkg_short_errors_supported=no
540+fi
541+ if test $_pkg_short_errors_supported = yes; then
542+ XINPUT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "x11 xext xi >= 1.4.1.99.1 inputproto >= 2.0.99.1" 2>&1`
543+ else
544+ XINPUT_PKG_ERRORS=`$PKG_CONFIG --print-errors "x11 xext xi >= 1.4.1.99.1 inputproto >= 2.0.99.1" 2>&1`
545+ fi
546+ # Put the nasty error message in config.log where it belongs
547+ echo "$XINPUT_PKG_ERRORS" >&5
548+
549+ as_fn_error $? "Package requirements (x11 xext xi >= 1.4.1.99.1 inputproto >= 2.0.99.1) were not met:
550+
551+$XINPUT_PKG_ERRORS
552+
553+Consider adjusting the PKG_CONFIG_PATH environment variable if you
554+installed software in a non-standard prefix.
555+
556+Alternatively, you may set the environment variables XINPUT_CFLAGS
557+and XINPUT_LIBS to avoid the need to call pkg-config.
558+See the pkg-config man page for more details." "$LINENO" 5
559+elif test $pkg_failed = untried; then
560+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
561+$as_echo "no" >&6; }
562+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
563+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
564+as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
565+is in your PATH or set the PKG_CONFIG environment variable to the full
566+path to pkg-config.
567+
568+Alternatively, you may set the environment variables XINPUT_CFLAGS
569+and XINPUT_LIBS to avoid the need to call pkg-config.
570+See the pkg-config man page for more details.
571+
572+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
573+See \`config.log' for more details" "$LINENO" 5 ; }
574+else
575+ XINPUT_CFLAGS=$pkg_cv_XINPUT_CFLAGS
576+ XINPUT_LIBS=$pkg_cv_XINPUT_LIBS
577+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
578+$as_echo "yes" >&6; }
579+
580+fi
581+
582+fi
583+
584 # Extract the first word of "a2x", so it can be a program name with args.
585 set dummy a2x; ac_word=$2
586 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
587@@ -11526,6 +11646,10 @@
588 as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
589 Usually this means the macro was only invoked conditionally." "$LINENO" 5
590 fi
591+if test -z "${HAVE_XI_TRUE}" && test -z "${HAVE_XI_FALSE}"; then
592+ as_fn_error $? "conditional \"HAVE_XI\" was never defined.
593+Usually this means the macro was only invoked conditionally." "$LINENO" 5
594+fi
595 if test -z "${HAVE_DOCTOOLS_TRUE}" && test -z "${HAVE_DOCTOOLS_FALSE}"; then
596 as_fn_error $? "conditional \"HAVE_DOCTOOLS\" was never defined.
597 Usually this means the macro was only invoked conditionally." "$LINENO" 5
598@@ -11938,7 +12062,7 @@
599 # report actual input values of CONFIG_FILES etc. instead of their
600 # values after options handling.
601 ac_log="
602-This file was extended by Touch Frame Library $as_me 1.0.0, which was
603+This file was extended by Touch Frame Library $as_me 1.1.0, which was
604 generated by GNU Autoconf 2.67. Invocation command line was
605
606 CONFIG_FILES = $CONFIG_FILES
607@@ -12004,7 +12128,7 @@
608 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
609 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
610 ac_cs_version="\\
611-Touch Frame Library config.status 1.0.0
612+Touch Frame Library config.status 1.1.0
613 configured by $0, generated by GNU Autoconf 2.67,
614 with options \\"\$ac_cs_config\\"
615
616
617=== modified file 'configure.ac'
618--- configure.ac 2011-02-03 19:22:55 +0000
619+++ configure.ac 2011-02-23 14:02:38 +0000
620@@ -1,7 +1,7 @@
621 # Initialize Autoconf
622 AC_PREREQ([2.60])
623 AC_INIT([Touch Frame Library],
624- [1.0.0],
625+ [1.1.0],
626 [],
627 [utouch-frame])
628 AC_CONFIG_SRCDIR([Makefile.am])
629@@ -12,7 +12,7 @@
630 AM_INIT_AUTOMAKE([foreign dist-bzip2])
631 AM_MAINTAINER_MODE
632
633-LIB_VERSION=1:0:0
634+LIB_VERSION=2:0:1
635 AC_SUBST([LIB_VERSION])
636
637 # Initialize libtool
638@@ -25,6 +25,13 @@
639 PKG_CHECK_MODULES([MTDEV], [mtdev >= 1.1])
640 PKG_CHECK_MODULES([EVEMU], [utouch-evemu >= 1.0])
641
642+AC_ARG_WITH([xi], AS_HELP_STRING([--with-xi], [Build with XI2.1 support]))
643+AM_CONDITIONAL([HAVE_XI], [test "x$with_xi" != "x"])
644+
645+AS_IF([test "x$with_xi" = "xyes"], [
646+ PKG_CHECK_MODULES(XINPUT, x11 xext [xi >= 1.4.1.99.1] [inputproto >= 2.0.99.1])
647+])
648+
649 AC_CHECK_PROG([ASCIIDOC], [a2x], [a2x])
650 AM_CONDITIONAL([HAVE_DOCTOOLS], [test "x$ASCIIDOC" != "x"])
651 AS_IF([test "x$ASCIIDOC" = "x"],
652
653=== modified file 'debian/changelog'
654--- debian/changelog 2011-02-22 13:45:55 +0000
655+++ debian/changelog 2011-02-23 14:02:38 +0000
656@@ -1,3 +1,10 @@
657+utouch-frame (1.1.0-0ubuntu1) UNRELEASED; urgency=low
658+
659+ * New upstream release.
660+ * Updating symbols file with api additions
661+
662+ -- Henrik Rydberg <rydberg@bitmath.org> Wed, 23 Feb 2011 14:58:31 +0100
663+
664 utouch-frame (1.0.0-0ubuntu3) natty; urgency=low
665
666 * Restore udeb support. utouch-grail is in some d-i initrds, depends on
667
668=== modified file 'debian/libutouch-frame1.symbols'
669--- debian/libutouch-frame1.symbols 2010-12-30 19:27:04 +0000
670+++ debian/libutouch-frame1.symbols 2011-02-23 14:02:38 +0000
671@@ -1,11 +1,14 @@
672 libutouch-frame.so.1 libutouch-frame1 #MINVER#
673 utouch_frame_delete_engine@Base 1.0.0
674 utouch_frame_get_current_slot@Base 1.0.0
675+ utouch_frame_get_num_frames@Base 1.1.0
676+ utouch_frame_get_num_slots@Base 1.1.0
677 utouch_frame_get_surface@Base 1.0.0
678 utouch_frame_get_version@Base 1.0.0
679 utouch_frame_init_mtdev@Base 1.0.0
680 utouch_frame_is_supported_mtdev@Base 1.0.0
681 utouch_frame_new_engine_raw@Base 1.0.0
682 utouch_frame_pump_mtdev@Base 1.0.0
683+ utouch_frame_set_current_id@Base 1.1.0
684 utouch_frame_set_current_slot@Base 1.0.0
685 utouch_frame_sync@Base 1.0.0
686
687=== modified file 'include/utouch/frame-mtdev.h'
688--- include/utouch/frame-mtdev.h 2010-12-30 19:26:42 +0000
689+++ include/utouch/frame-mtdev.h 2011-02-23 14:02:38 +0000
690@@ -22,6 +22,10 @@
691 #ifndef _UTOUCH_FRAME_MTDEV_H
692 #define _UTOUCH_FRAME_MTDEV_H
693
694+#ifdef __cplusplus
695+extern "C" {
696+#endif
697+
698 #define MTDEV_NO_LEGACY_API
699
700 #include <utouch/frame.h>
701@@ -36,4 +40,8 @@
702 const struct utouch_frame *
703 utouch_frame_pump_mtdev(utouch_frame_handle fh, const struct input_event *ev);
704
705+#ifdef __cplusplus
706+}
707+#endif
708+
709 #endif
710
711=== added file 'include/utouch/frame-xi2.h'
712--- include/utouch/frame-xi2.h 1970-01-01 00:00:00 +0000
713+++ include/utouch/frame-xi2.h 2011-02-23 14:02:38 +0000
714@@ -0,0 +1,49 @@
715+/*****************************************************************************
716+ *
717+ * utouch-frame - Touch Frame Library
718+ *
719+ * Copyright (C) 2010-2011 Canonical Ltd.
720+ *
721+ * This program is free software: you can redistribute it and/or modify it
722+ * under the terms of the GNU General Public License as published by the
723+ * Free Software Foundation, either version 3 of the License, or (at your
724+ * option) any later version.
725+ *
726+ * This program is distributed in the hope that it will be useful, but
727+ * WITHOUT ANY WARRANTY; without even the implied warranty of
728+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
729+ * General Public License for more details.
730+ *
731+ * You should have received a copy of the GNU General Public License along
732+ * with this program. If not, see <http://www.gnu.org/licenses/>.
733+ *
734+ ****************************************************************************/
735+
736+#ifndef _UTOUCH_FRAME_XI2_H
737+#define _UTOUCH_FRAME_XI2_H
738+
739+#ifdef __cplusplus
740+extern "C" {
741+#endif
742+
743+#define MTDEV_NO_LEGACY_API
744+
745+#include <utouch/frame.h>
746+#include <X11/extensions/XInput2.h>
747+
748+int utouch_frame_is_supported_xi2(Display *dpy, const XIDeviceInfo *dev);
749+
750+int utouch_frame_init_xi2(utouch_frame_handle fh,
751+ Display *dpy, const XIDeviceInfo *dev);
752+
753+int utouch_frame_configure_xi2(utouch_frame_handle fh,
754+ const XConfigureEvent *ev);
755+
756+const struct utouch_frame *
757+utouch_frame_pump_xi2(utouch_frame_handle fh, const XIDeviceEvent *ev);
758+
759+#ifdef __cplusplus
760+}
761+#endif
762+
763+#endif
764
765=== modified file 'include/utouch/frame.h'
766--- include/utouch/frame.h 2010-12-30 19:26:42 +0000
767+++ include/utouch/frame.h 2011-02-23 14:02:38 +0000
768@@ -22,9 +22,13 @@
769 #ifndef _UTOUCH_FRAME_H
770 #define _UTOUCH_FRAME_H
771
772+#ifdef __cplusplus
773+extern "C" {
774+#endif
775+
776 #include <stdint.h>
777
778-#define UTOUCH_FRAME_VERSION 0x00001000
779+#define UTOUCH_FRAME_VERSION 0x00001010
780
781 /**
782 * struct utouch_surface - device surface details
783@@ -42,11 +46,23 @@
784 * @phys_width: physical width in millimeters (mm)
785 * @phys_height: physical height in millimeters (mm)
786 * @phys_pressure: maximal physical pressure (N/cm^2)
787- * @min_x: minimum horizontal coordinate value
788- * @min_y: minimum vertical coordinate value
789- * @max_x: maximum horizontal coordinate value
790- * @max_y: maximum vertical coordinate value
791- * @max_pressure: maximum pressure coordinate value
792+ * @min_x: minimum horizontal device coordinate
793+ * @min_y: minimum vertical device coordinate
794+ * @max_x: maximum horizontal device coordinate
795+ * @max_y: maximum vertical device coordinate
796+ * @max_pressure: maximum pressure device coordinate
797+ * @max_orient: maximum orientation device coordinate
798+ * @mapped_min_x: minimum horizontal mapped coordinate
799+ * @mapped_min_y: minimum vertical mapped coordinate
800+ * @mapped_max_x: maximum horizontal mapped coordinate
801+ * @mapped_max_y: maximum vertical mapped coordinate
802+ * @mapped_max_pressure: maximum pressure mapped coordinate
803+ *
804+ * The mutable contact given by utouch_frame_get_current_slot() should
805+ * be set in device coordinates. The contact data is subsequently
806+ * transformed to mapped (e.g., screen) coordinates in
807+ * utouch_frame_sync(). To a frame user, all data will appear in
808+ * mapped coordinates.
809 *
810 * Device properties and touch surface details. Later versions of this
811 * struct may grow in size, but will remain binary compatible with
812@@ -72,6 +88,12 @@
813 float max_x;
814 float max_y;
815 float max_pressure;
816+ float max_orient;
817+ float mapped_min_x;
818+ float mapped_min_y;
819+ float mapped_max_x;
820+ float mapped_max_y;
821+ float mapped_max_pressure;
822 };
823
824 #define UTOUCH_TOOL_FINGER 0
825@@ -93,6 +115,8 @@
826 * @orientation: direction of ellipse (left: -Pi/2, up: 0, right: Pi/2)
827 * @pressure: pressure of contact (pressure units)
828 * @distance: distance of contact (surface units)
829+ * @vx: horizontal velocity coordinate (units / millisecond)
830+ * @vy: vertical velocity coordinate (units / millisecond)
831 *
832 * Surface contact details. Later versions of this struct may grow in
833 * size, but will remain binary compatible with older versions.
834@@ -116,6 +140,8 @@
835 float orientation;
836 float pressure;
837 float distance;
838+ float vx;
839+ float vy;
840 };
841
842 /* time in milliseconds */
843@@ -163,6 +189,20 @@
844 */
845 unsigned int utouch_frame_get_version(void);
846
847+/**
848+ * utouch_frame_get_num_frames - get number of supported frames
849+ *
850+ * Returns the number of frames supported by this engine.
851+ */
852+unsigned int utouch_frame_get_num_frames(utouch_frame_handle fh);
853+
854+/**
855+ * utouch_frame_get_num_slots - get number of supported slots
856+ *
857+ * Returns the number of simultaneous contacts supported by this engine.
858+ */
859+unsigned int utouch_frame_get_num_slots(utouch_frame_handle fh);
860+
861 utouch_frame_handle utouch_frame_new_engine_raw(unsigned int num_frames,
862 unsigned int num_slots,
863 unsigned int frame_rate,
864@@ -228,6 +268,17 @@
865 int utouch_frame_set_current_slot(utouch_frame_handle fh, int slot);
866
867 /**
868+ * utouch_frame_set_current_id - set the current slot by touch id
869+ * @fh: the frame engine in use
870+ * @id: the touch id
871+ *
872+ * Sets the slot currently being modified, by touch id. If the id is
873+ * not currently in use (does not have an active slot), a new slot is
874+ * assigned. Returns zero if successful, negative error otherwise.
875+ */
876+int utouch_frame_set_current_id(utouch_frame_handle fh, int id);
877+
878+/**
879 * utouch_frame_sync - synchronize and return new frame
880 * @fh: the frame engine in use
881 * @time: the frame synchronization time (ms)
882@@ -247,4 +298,8 @@
883 const struct utouch_frame *utouch_frame_sync(utouch_frame_handle fh,
884 utouch_frame_time_t time);
885
886+#ifdef __cplusplus
887+}
888+#endif
889+
890 #endif
891
892=== modified file 'src/Makefile.am'
893--- src/Makefile.am 2010-12-30 19:26:42 +0000
894+++ src/Makefile.am 2011-02-23 14:02:38 +0000
895@@ -3,7 +3,7 @@
896 libutouch_frame_la_LDFLAGS = \
897 -version-info @LIB_VERSION@ \
898 -lm \
899- $(EVEMU_LIBS)
900+ $(EVEMU_LIBS) \
901 $(MTDEV_LIBS)
902
903 libutouch_frame_la_SOURCES = \
904@@ -19,3 +19,11 @@
905 libutouch_frameinclude_HEADERS = \
906 $(top_srcdir)/include/utouch/frame.h \
907 $(top_srcdir)/include/utouch/frame-mtdev.h
908+
909+if HAVE_XI
910+
911+libutouch_frame_la_LDFLAGS += $(XINPUT_LIBS) $(X11_LIBS)
912+libutouch_frame_la_SOURCES += frame-xi2.c
913+libutouch_frameinclude_HEADERS += $(top_srcdir)/include/utouch/frame-xi2.h
914+
915+endif
916
917=== modified file 'src/Makefile.in'
918--- src/Makefile.in 2010-12-30 19:26:42 +0000
919+++ src/Makefile.in 2011-02-23 14:02:38 +0000
920@@ -35,9 +35,12 @@
921 POST_UNINSTALL = :
922 build_triplet = @build@
923 host_triplet = @host@
924+@HAVE_XI_TRUE@am__append_1 = $(XINPUT_LIBS) $(X11_LIBS)
925+@HAVE_XI_TRUE@am__append_2 = frame-xi2.c
926+@HAVE_XI_TRUE@am__append_3 = $(top_srcdir)/include/utouch/frame-xi2.h
927 subdir = src
928-DIST_COMMON = $(libutouch_frameinclude_HEADERS) $(srcdir)/Makefile.am \
929- $(srcdir)/Makefile.in
930+DIST_COMMON = $(am__libutouch_frameinclude_HEADERS_DIST) \
931+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in
932 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
933 am__aclocal_m4_deps = $(top_srcdir)/configure.ac
934 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
935@@ -71,7 +74,11 @@
936 "$(DESTDIR)$(libutouch_frameincludedir)"
937 LTLIBRARIES = $(lib_LTLIBRARIES)
938 libutouch_frame_la_LIBADD =
939-am_libutouch_frame_la_OBJECTS = frame.lo frame-mtdev.lo
940+am__libutouch_frame_la_SOURCES_DIST = frame-impl.h frame.c \
941+ frame-mtdev.c frame-xi2.c
942+@HAVE_XI_TRUE@am__objects_1 = frame-xi2.lo
943+am_libutouch_frame_la_OBJECTS = frame.lo frame-mtdev.lo \
944+ $(am__objects_1)
945 libutouch_frame_la_OBJECTS = $(am_libutouch_frame_la_OBJECTS)
946 libutouch_frame_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
947 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
948@@ -90,7 +97,11 @@
949 --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
950 $(LDFLAGS) -o $@
951 SOURCES = $(libutouch_frame_la_SOURCES)
952-DIST_SOURCES = $(libutouch_frame_la_SOURCES)
953+DIST_SOURCES = $(am__libutouch_frame_la_SOURCES_DIST)
954+am__libutouch_frameinclude_HEADERS_DIST = \
955+ $(top_srcdir)/include/utouch/frame.h \
956+ $(top_srcdir)/include/utouch/frame-mtdev.h \
957+ $(top_srcdir)/include/utouch/frame-xi2.h
958 HEADERS = $(libutouch_frameinclude_HEADERS)
959 ETAGS = etags
960 CTAGS = ctags
961@@ -98,6 +109,7 @@
962 ACLOCAL = @ACLOCAL@
963 AMTAR = @AMTAR@
964 AR = @AR@
965+ASCIIDOC = @ASCIIDOC@
966 AUTOCONF = @AUTOCONF@
967 AUTOHEADER = @AUTOHEADER@
968 AUTOMAKE = @AUTOMAKE@
969@@ -163,6 +175,8 @@
970 SHELL = @SHELL@
971 STRIP = @STRIP@
972 VERSION = @VERSION@
973+XINPUT_CFLAGS = @XINPUT_CFLAGS@
974+XINPUT_LIBS = @XINPUT_LIBS@
975 abs_builddir = @abs_builddir@
976 abs_srcdir = @abs_srcdir@
977 abs_top_builddir = @abs_top_builddir@
978@@ -216,23 +230,15 @@
979 top_builddir = @top_builddir@
980 top_srcdir = @top_srcdir@
981 lib_LTLIBRARIES = libutouch-frame.la
982-libutouch_frame_la_LDFLAGS = \
983- -version-info @LIB_VERSION@ \
984- -lm \
985- $(EVEMU_LIBS)
986-
987-libutouch_frame_la_SOURCES = \
988- frame-impl.h \
989- frame.c \
990- frame-mtdev.c
991-
992+libutouch_frame_la_LDFLAGS = -version-info @LIB_VERSION@ -lm \
993+ $(EVEMU_LIBS) $(MTDEV_LIBS) $(am__append_1)
994+libutouch_frame_la_SOURCES = frame-impl.h frame.c frame-mtdev.c \
995+ $(am__append_2)
996 AM_CFLAGS = $(CWARNFLAGS)
997 INCLUDES = -I$(top_srcdir)/include/
998 libutouch_frameincludedir = $(includedir)/utouch
999-libutouch_frameinclude_HEADERS = \
1000- $(top_srcdir)/include/utouch/frame.h \
1001- $(top_srcdir)/include/utouch/frame-mtdev.h
1002-
1003+libutouch_frameinclude_HEADERS = $(top_srcdir)/include/utouch/frame.h \
1004+ $(top_srcdir)/include/utouch/frame-mtdev.h $(am__append_3)
1005 all: all-am
1006
1007 .SUFFIXES:
1008@@ -308,6 +314,7 @@
1009 -rm -f *.tab.c
1010
1011 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frame-mtdev.Plo@am__quote@
1012+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frame-xi2.Plo@am__quote@
1013 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frame.Plo@am__quote@
1014
1015 .c.o:
1016@@ -561,7 +568,6 @@
1017 uninstall-am uninstall-libLTLIBRARIES \
1018 uninstall-libutouch_frameincludeHEADERS
1019
1020- $(MTDEV_LIBS)
1021
1022 # Tell versions [3.59,3.63) of GNU make to not export all variables.
1023 # Otherwise a system limit (for SysV at least) may be exceeded.
1024
1025=== modified file 'src/frame-impl.h'
1026--- src/frame-impl.h 2011-02-03 19:22:55 +0000
1027+++ src/frame-impl.h 2011-02-23 14:02:38 +0000
1028@@ -30,10 +30,11 @@
1029 int hold_ms;
1030 int frame;
1031 int slot;
1032- float max_orient;
1033 struct utouch_surface *surface;
1034 struct utouch_frame **frames;
1035 struct utouch_frame *next;
1036+ int *evmap;
1037+ float map[9];
1038 };
1039
1040 #endif
1041
1042=== modified file 'src/frame-mtdev.c'
1043--- src/frame-mtdev.c 2010-12-30 19:26:42 +0000
1044+++ src/frame-mtdev.c 2011-02-23 14:02:38 +0000
1045@@ -25,6 +25,16 @@
1046 #include <errno.h>
1047 #include <math.h>
1048
1049+static int is_pointer(const struct evemu_device *dev)
1050+{
1051+ return evemu_has_event(dev, EV_REL, REL_X) ||
1052+ evemu_has_event(dev, EV_KEY, BTN_TOOL_FINGER) ||
1053+ evemu_has_event(dev, EV_KEY, BTN_TOOL_PEN) ||
1054+ evemu_has_event(dev, EV_KEY, BTN_STYLUS) ||
1055+ evemu_has_event(dev, EV_KEY, BTN_MOUSE) ||
1056+ evemu_has_event(dev, EV_KEY, BTN_LEFT);
1057+}
1058+
1059 int utouch_frame_is_supported_mtdev(const struct evemu_device *dev)
1060 {
1061
1062@@ -52,11 +62,22 @@
1063 if (!utouch_frame_is_supported_mtdev(dev))
1064 return -ENODEV;
1065
1066+ if (is_pointer(dev)) {
1067+ s->needs_pointer = 1;
1068+ s->is_direct = 0;
1069+ } else {
1070+ s->needs_pointer = 0;
1071+ s->is_direct = 1;
1072+ }
1073+
1074+ s->is_buttonpad = 0;
1075+ s->is_semi_mt = 0;
1076+
1077 #ifdef INPUT_PROP_POINTER
1078- s->needs_pointer = evemu_has_prop(dev, INPUT_PROP_POINTER);
1079- s->is_direct = evemu_has_prop(dev, INPUT_PROP_DIRECT);
1080- s->is_buttonpad = evemu_has_prop(dev, INPUT_PROP_BUTTONPAD);
1081- s->is_semi_mt = evemu_has_prop(dev, INPUT_PROP_SEMI_MT);
1082+ s->needs_pointer |= evemu_has_prop(dev, INPUT_PROP_POINTER);
1083+ s->is_direct |= evemu_has_prop(dev, INPUT_PROP_DIRECT);
1084+ s->is_buttonpad |= evemu_has_prop(dev, INPUT_PROP_BUTTONPAD);
1085+ s->is_semi_mt |= evemu_has_prop(dev, INPUT_PROP_SEMI_MT);
1086 #endif
1087 s->use_touch_major = evemu_has_event(dev, EV_ABS, ABS_MT_TOUCH_MAJOR);
1088 s->use_touch_minor = evemu_has_event(dev, EV_ABS, ABS_MT_TOUCH_MINOR);
1089@@ -83,12 +104,12 @@
1090 }
1091
1092 s->max_pressure = evemu_get_abs_maximum(dev, ABS_MT_PRESSURE);
1093- if (s->use_pressure && s->max_pressure == 0)
1094+ if (s->max_pressure == 0)
1095 s->max_pressure = 256;
1096
1097- fh->max_orient = evemu_get_abs_maximum(dev, ABS_MT_ORIENTATION);
1098- if (s->use_orientation && fh->max_orient == 0)
1099- fh->max_orient = 1;
1100+ s->max_orient = evemu_get_abs_maximum(dev, ABS_MT_ORIENTATION);
1101+ if (s->max_orient == 0)
1102+ s->max_orient = 1;
1103
1104 tmp = evemu_get_abs_resolution(dev, ABS_MT_POSITION_X);
1105 if (tmp > 0)
1106@@ -112,14 +133,16 @@
1107 else
1108 s->phys_pressure = 10;
1109
1110+ /* defaults expected by initial frame version */
1111+ s->mapped_min_x = s->min_x;
1112+ s->mapped_min_y = s->min_y;
1113+ s->mapped_max_x = s->max_x;
1114+ s->mapped_max_y = s->max_y;
1115+ s->mapped_max_pressure = s->max_pressure;
1116+
1117 return 0;
1118 }
1119
1120-static float touch_angle(utouch_frame_handle fh, int orient)
1121-{
1122- return orient / fh->max_orient * M_PI_2;
1123-}
1124-
1125 static int handle_abs_event(utouch_frame_handle fh,
1126 const struct input_event *ev)
1127 {
1128@@ -131,9 +154,11 @@
1129 return 1;
1130 case ABS_MT_POSITION_X:
1131 t->x = ev->value;
1132+ t->vx = 0;
1133 return 1;
1134 case ABS_MT_POSITION_Y:
1135 t->y = ev->value;
1136+ t->vy = 0;
1137 return 1;
1138 case ABS_MT_TOUCH_MAJOR:
1139 t->touch_major = ev->value;
1140@@ -148,7 +173,7 @@
1141 t->width_minor = ev->value;
1142 return 1;
1143 case ABS_MT_ORIENTATION:
1144- t->orientation = touch_angle(fh, ev->value);
1145+ t->orientation = ev->value;
1146 return 1;
1147 case ABS_MT_PRESSURE:
1148 t->pressure = ev->value;
1149
1150=== added file 'src/frame-xi2.c'
1151--- src/frame-xi2.c 1970-01-01 00:00:00 +0000
1152+++ src/frame-xi2.c 2011-02-23 14:02:38 +0000
1153@@ -0,0 +1,322 @@
1154+/*****************************************************************************
1155+ *
1156+ * utouch-frame - Touch Frame Library
1157+ *
1158+ * Copyright (C) 2010 Canonical Ltd.
1159+ *
1160+ * This program is free software: you can redistribute it and/or modify it
1161+ * under the terms of the GNU General Public License as published by the
1162+ * Free Software Foundation, either version 3 of the License, or (at your
1163+ * option) any later version.
1164+ *
1165+ * This program is distributed in the hope that it will be useful, but
1166+ * WITHOUT ANY WARRANTY; without even the implied warranty of
1167+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1168+ * General Public License for more details.
1169+ *
1170+ * You should have received a copy of the GNU General Public License along
1171+ * with this program. If not, see <http://www.gnu.org/licenses/>.
1172+ *
1173+ ****************************************************************************/
1174+#include <utouch/frame-xi2.h>
1175+#include <xorg/xserver-properties.h>
1176+#include <linux/input.h>
1177+#include "frame-impl.h"
1178+#include <stdlib.h>
1179+#include <stdio.h>
1180+#include <errno.h>
1181+#include <math.h>
1182+#include <string.h>
1183+#include <X11/Xlib.h>
1184+
1185+static Atom transform_atom;
1186+
1187+#define set_field(fh, name, number, field) \
1188+ if (!strcmp(name, AXIS_LABEL_PROP_##field) && \
1189+ (fh->evmap[number] = field))
1190+
1191+int utouch_frame_is_supported_xi2(Display *dpy, const XIDeviceInfo *dev)
1192+{
1193+
1194+ int i;
1195+
1196+ for (i = 0; i < dev->num_classes; i++)
1197+ if (dev->classes[i]->type == XITouchClass)
1198+ return 1;
1199+
1200+ return 0;
1201+}
1202+
1203+static void init_properties(utouch_frame_handle fh,
1204+ Display *dpy, const XIDeviceInfo *dev)
1205+{
1206+ struct utouch_surface *s = fh->surface;
1207+ XITouchClassInfo *v;
1208+ int i;
1209+
1210+ for (i = 0; i < dev->num_classes; i++) {
1211+ v = (void *)dev->classes[i];
1212+ if (v->type != XITouchClass)
1213+ continue;
1214+ switch(v->mode) {
1215+ case XIDependentTouch:
1216+ s->needs_pointer = 1;
1217+ break;
1218+ case XIDirectTouch:
1219+ s->is_direct = 1;
1220+ break;
1221+ default:
1222+ fprintf(stderr, "unknown mode\n");
1223+ break;
1224+ }
1225+ }
1226+
1227+ if (transform_atom == None)
1228+ transform_atom = XInternAtom(dpy, XI_PROP_TRANSFORM, True);
1229+
1230+ fh->map[0] = fh->map[4] = fh->map[8] = 1;
1231+}
1232+
1233+static void update_transform(utouch_frame_handle fh, Display *dpy, int devid)
1234+{
1235+ unsigned long nitem, nbyte;
1236+ unsigned char *data;
1237+ int format;
1238+ Atom type;
1239+
1240+ if (transform_atom == None)
1241+ return;
1242+
1243+ XIGetProperty(dpy, devid, transform_atom, 0, 9, False,
1244+ AnyPropertyType, &type, &format, &nitem, &nbyte, &data);
1245+
1246+ if (format == 32 && nitem == 9 && nbyte == 0)
1247+ memcpy(fh->map, data, sizeof(fh->map));
1248+ else
1249+ fprintf(stderr, "Invalid transform matrix\n");
1250+
1251+ XFree(data);
1252+}
1253+
1254+static void update_screen(utouch_frame_handle fh, Display *dpy)
1255+{
1256+ struct utouch_surface *s = fh->surface;
1257+ XWindowAttributes attrs;
1258+ float x1, y1, x2, y2;
1259+
1260+ XGetWindowAttributes(dpy, XDefaultRootWindow(dpy), &attrs);
1261+
1262+ x1 = 0;
1263+ y1 = 0;
1264+ x2 = attrs.width;
1265+ y2 = attrs.height;
1266+
1267+ s->mapped_min_x = fh->map[0] * x1 + fh->map[1] * y1 + fh->map[2];
1268+ s->mapped_min_y = fh->map[3] * x1 + fh->map[4] * y1 + fh->map[5];
1269+ s->mapped_max_x = fh->map[0] * x2 + fh->map[1] * y2 + fh->map[2];
1270+ s->mapped_max_y = fh->map[3] * x2 + fh->map[4] * y2 + fh->map[5];
1271+ s->mapped_max_pressure = 1;
1272+
1273+ fprintf(stderr, "frame map: %f %f %f %f %f\n",
1274+ s->mapped_min_x, s->mapped_min_y,
1275+ s->mapped_max_x, s->mapped_max_y, s->mapped_max_pressure);
1276+}
1277+
1278+static void init_valuators(utouch_frame_handle fh,
1279+ Display *dpy, const XIDeviceInfo *dev)
1280+{
1281+ struct utouch_surface *s = fh->surface;
1282+ XITouchValuatorClassInfo *v;
1283+ char *name;
1284+ int i;
1285+
1286+ s->phys_width = 100;
1287+ s->phys_height = 65;
1288+ s->phys_pressure = 10;
1289+ s->max_x = 1024;
1290+ s->max_y = 768;
1291+ s->max_pressure = 256;
1292+ s->max_orient = 1;
1293+
1294+ for (i = 0; i < dev->num_classes; i++) {
1295+ v = (void *)dev->classes[i];
1296+ if (v->type != XITouchValuatorClass)
1297+ continue;
1298+ name = XGetAtomName(dpy, v->label);
1299+ set_field(fh, name, v->number, ABS_MT_POSITION_X) {
1300+ s->min_x = v->min;
1301+ s->max_x = v->max;
1302+ if (v->resolution > 0)
1303+ s->phys_width = (v->max - v->min) /
1304+ v->resolution;
1305+ }
1306+ set_field(fh, name, v->number, ABS_MT_POSITION_Y) {
1307+ s->min_y = v->min;
1308+ s->max_y = v->max;
1309+ if (v->resolution > 0)
1310+ s->phys_height = (v->max - v->min) /
1311+ v->resolution;
1312+ }
1313+ set_field(fh, name, v->number, ABS_MT_TOUCH_MAJOR) {
1314+ s->use_touch_major = 1;
1315+ }
1316+ set_field(fh, name, v->number, ABS_MT_TOUCH_MINOR) {
1317+ s->use_touch_minor = 1;
1318+ }
1319+ set_field(fh, name, v->number, ABS_MT_WIDTH_MAJOR) {
1320+ s->use_width_major = 1;
1321+ }
1322+ set_field(fh, name, v->number, ABS_MT_WIDTH_MINOR) {
1323+ s->use_width_minor = 1;
1324+ }
1325+ set_field(fh, name, v->number, ABS_MT_ORIENTATION) {
1326+ s->use_orientation = 1;
1327+ s->max_orient = v->max > 0 ? v->max : 1;
1328+ }
1329+ set_field(fh, name, v->number, ABS_MT_PRESSURE) {
1330+ s->use_pressure = 1;
1331+ s->max_pressure = v->max > 0 ? v->max : 256;
1332+ if (v->resolution > 0)
1333+ s->phys_pressure = v->max / v->resolution;
1334+ }
1335+#ifdef ABS_MT_DISTANCE
1336+#ifdef AXIS_LABEL_PROP_ABS_MT_DISTANCE
1337+ set_field(fh, name, v->number, ABS_MT_DISTANCE) {
1338+ s->use_distance = 1;
1339+ }
1340+#endif
1341+#endif
1342+ XFree(name);
1343+ }
1344+}
1345+
1346+int utouch_frame_init_xi2(utouch_frame_handle fh,
1347+ Display *dpy, const XIDeviceInfo *dev)
1348+{
1349+ int event;
1350+ int err;
1351+
1352+ free(fh->evmap);
1353+ fh->evmap =calloc(dev->num_classes, sizeof(int));
1354+ if (!fh->evmap)
1355+ return -ENOMEM;
1356+
1357+ if (!utouch_frame_is_supported_xi2(dpy, dev))
1358+ return -ENODEV;
1359+
1360+ init_properties(fh, dpy, dev);
1361+ init_valuators(fh, dpy, dev);
1362+ update_transform(fh, dpy, dev->deviceid);
1363+ update_screen(fh, dpy);
1364+
1365+ return 0;
1366+}
1367+
1368+static int handle_event(utouch_frame_handle fh,
1369+ struct utouch_contact *slot,
1370+ int ix, float value)
1371+{
1372+ switch (fh->evmap[ix]) {
1373+ case ABS_MT_POSITION_X:
1374+ slot->x = value;
1375+ slot->vx = 0;
1376+ return 1;
1377+ case ABS_MT_POSITION_Y:
1378+ slot->y = value;
1379+ slot->vy = 0;
1380+ return 1;
1381+ case ABS_MT_TOUCH_MAJOR:
1382+ slot->touch_major = value;
1383+ return 1;
1384+ case ABS_MT_TOUCH_MINOR:
1385+ slot->touch_minor = value;
1386+ return 1;
1387+ case ABS_MT_WIDTH_MAJOR:
1388+ slot->width_major = value;
1389+ return 1;
1390+ case ABS_MT_WIDTH_MINOR:
1391+ slot->width_minor = value;
1392+ return 1;
1393+ case ABS_MT_ORIENTATION:
1394+ slot->orientation = value;
1395+ return 1;
1396+ case ABS_MT_PRESSURE:
1397+ slot->pressure = value;
1398+ return 1;
1399+#ifdef ABS_MT_DISTANCE
1400+ case ABS_MT_DISTANCE:
1401+ slot->distance = value;
1402+ return 1;
1403+#endif
1404+ case ABS_MT_TOOL_TYPE:
1405+ slot->tool_type = value;
1406+ return 1;
1407+ default:
1408+ fprintf(stderr, "did not get that one: %d\n", ix);
1409+ return 0;
1410+ }
1411+}
1412+
1413+int utouch_frame_configure_xi2(utouch_frame_handle fh,
1414+ const XConfigureEvent *ev)
1415+{
1416+ if (ev->display)
1417+ update_screen(fh, ev->display);
1418+ return 1;
1419+}
1420+
1421+const struct utouch_frame *sync_xi2(utouch_frame_handle fh,
1422+ utouch_frame_time_t time)
1423+{
1424+ struct utouch_frame *next = fh->next;
1425+ int i;
1426+
1427+ /* no velocity adjustments without device time stamps in place */
1428+ for (i = 0; i < fh->num_slots; i++) {
1429+ struct utouch_contact *q = next->slots[i];
1430+ q->vx = 0;
1431+ q->vy = 0;
1432+ }
1433+
1434+ return utouch_frame_sync(fh, time);
1435+}
1436+
1437+const struct utouch_frame *
1438+utouch_frame_pump_xi2(utouch_frame_handle fh, const XIDeviceEvent *ev)
1439+{
1440+ const XIPropertyEvent *prop_ev;
1441+ const double *value;
1442+ const unsigned char *mask;
1443+ struct utouch_contact *slot;
1444+ int touchid, nbyte, nbit, num, i;
1445+
1446+ switch (ev->evtype) {
1447+ case XI_TouchBegin:
1448+ case XI_TouchUpdate:
1449+ case XI_TouchEnd:
1450+ value = ev->valuators.values;
1451+ mask = ev->valuators.mask;
1452+ touchid = ev->detail;
1453+ nbyte = ev->valuators.mask_len;
1454+ nbit = nbyte << 3;
1455+
1456+ utouch_frame_set_current_id(fh, touchid);
1457+ slot = utouch_frame_get_current_slot(fh);
1458+ num = 0;
1459+ for (i = 0; i < nbit; i++)
1460+ if (XIMaskIsSet(mask, i))
1461+ handle_event(fh, slot, i, value[num++]);
1462+ if (ev->evtype == XI_TouchEnd)
1463+ utouch_frame_get_current_slot(fh)->id = -1;
1464+ return sync_xi2(fh, ev->time);
1465+ case XI_PropertyEvent:
1466+ prop_ev = (XIPropertyEvent *)ev;
1467+ if (prop_ev->property == transform_atom && ev->display) {
1468+ update_transform(fh, ev->display, ev->deviceid);
1469+ update_screen(fh, ev->display);
1470+ }
1471+ break;
1472+ }
1473+
1474+ return 0;
1475+}
1476
1477=== modified file 'src/frame.c'
1478--- src/frame.c 2010-12-30 19:26:42 +0000
1479+++ src/frame.c 2011-02-23 14:02:38 +0000
1480@@ -33,6 +33,16 @@
1481 return UTOUCH_FRAME_VERSION;
1482 }
1483
1484+unsigned int utouch_frame_get_num_frames(utouch_frame_handle fh)
1485+{
1486+ return fh->num_frames;
1487+}
1488+
1489+unsigned int utouch_frame_get_num_slots(utouch_frame_handle fh)
1490+{
1491+ return fh->num_slots;
1492+}
1493+
1494 static void destroy_slots(struct utouch_contact **slots, int nslot)
1495 {
1496 int i;
1497@@ -181,6 +191,7 @@
1498
1499 void utouch_frame_delete_engine(utouch_frame_handle fh)
1500 {
1501+ free(fh->evmap);
1502 destroy_frame(fh->next, fh->num_slots);
1503 destroy_frames(fh->frames, fh->num_frames, fh->num_slots);
1504 free(fh->surface);
1505@@ -205,11 +216,53 @@
1506 return 0;
1507 }
1508
1509-static void copy_contact(utouch_frame_handle fh,
1510- struct utouch_contact *a,
1511- const struct utouch_contact *b)
1512-{
1513+int utouch_frame_set_current_id(utouch_frame_handle fh, int id)
1514+{
1515+ struct utouch_contact *t;
1516+ int i;
1517+
1518+ for (i = 0; i < fh->num_slots; i++) {
1519+ t = fh->next->slots[i];
1520+ if (t->id == id)
1521+ return utouch_frame_set_current_slot(fh, i);
1522+ }
1523+ for (i = 0; i < fh->num_slots; i++) {
1524+ t = fh->next->slots[i];
1525+ if (t->id < 0) {
1526+ t->id = id;
1527+ return utouch_frame_set_current_slot(fh, i);
1528+ }
1529+ }
1530+ return -ENOMEM;
1531+}
1532+
1533+static void transform_slot(struct utouch_contact *slot,
1534+ const struct utouch_surface *s)
1535+{
1536+ float fx = (s->mapped_max_x - s->mapped_min_x) / (s->max_x - s->min_x);
1537+ float fy = (s->mapped_max_y - s->mapped_min_y) / (s->max_y - s->min_y);
1538+ /* assume clipped view for asymmetrical scaling */
1539+ float f = MAX(fx, fy);
1540+
1541+ slot->x = fx * (slot->x - s->min_x) + s->mapped_min_x;
1542+ slot->y = fy * (slot->y - s->min_y) + s->mapped_min_y;
1543+ slot->touch_major *= f;
1544+ slot->touch_minor *= f;
1545+ slot->width_major *= f;
1546+ slot->width_minor *= f;
1547+ slot->orientation *= M_PI_2 / s->max_orient;
1548+ slot->pressure *= s->mapped_max_pressure / s->max_pressure;
1549+ slot->distance *= f;
1550+}
1551+
1552+static void set_contact(utouch_frame_handle fh,
1553+ struct utouch_contact *a,
1554+ struct utouch_contact *b,
1555+ utouch_frame_time_t dt)
1556+{
1557+ static const float D = 0.333;
1558 struct utouch_surface *s = fh->surface;
1559+ const struct utouch_contact *ap = a->prev;
1560
1561 a->active = b->id != -1;
1562 a->id = b->id;
1563@@ -225,6 +278,23 @@
1564 a->orientation = b->orientation;
1565 a->pressure = b->pressure;
1566 a->distance = b->distance;
1567+
1568+ transform_slot(a, s);
1569+
1570+ if (a->active && ap->active && a->id == ap->id) {
1571+ a->x += b->vx * dt;
1572+ a->y += b->vy * dt;
1573+ if (dt > 0) {
1574+ a->vx = (1 - D) * ap->vx + D * (a->x - ap->x) / dt;
1575+ a->vy = (1 - D) * ap->vy + D * (a->y - ap->y) / dt;
1576+ }
1577+ } else {
1578+ a->vx = 0;
1579+ a->vy = 0;
1580+ }
1581+
1582+ b->vx = a->vx;
1583+ b->vy = a->vy;
1584 }
1585
1586 static int detect_addrem(const struct utouch_contact *a,
1587@@ -261,14 +331,18 @@
1588 const struct utouch_frame *prev = frame->prev;
1589 struct utouch_frame *next = fh->next;
1590 int naddrem = 0, nmod = 0;
1591+ utouch_frame_time_t dt;
1592 int i;
1593
1594+ frame->time = time ? time : get_time_ms();
1595 frame->num_active = 0;
1596+ dt = frame->time - prev->time;
1597+
1598 for (i = 0; i < fh->num_slots; i++) {
1599 struct utouch_contact *p = frame->slots[i];
1600- const struct utouch_contact *q = next->slots[i];
1601+ struct utouch_contact *q = next->slots[i];
1602
1603- copy_contact(fh, p, q);
1604+ set_contact(fh, p, q, dt);
1605 if (p->active)
1606 frame->active[frame->num_active++] = p;
1607
1608@@ -278,7 +352,6 @@
1609 if (naddrem + nmod == 0)
1610 return 0;
1611
1612- frame->time = time ? time : get_time_ms();
1613 if (naddrem == 0 && frame->time < prev->time + fh->hold_ms)
1614 return 0;
1615
1616
1617=== modified file 'test/Makefile.in'
1618--- test/Makefile.in 2010-12-30 19:26:42 +0000
1619+++ test/Makefile.in 2011-02-23 14:02:38 +0000
1620@@ -49,6 +49,7 @@
1621 ACLOCAL = @ACLOCAL@
1622 AMTAR = @AMTAR@
1623 AR = @AR@
1624+ASCIIDOC = @ASCIIDOC@
1625 AUTOCONF = @AUTOCONF@
1626 AUTOHEADER = @AUTOHEADER@
1627 AUTOMAKE = @AUTOMAKE@
1628@@ -114,6 +115,8 @@
1629 SHELL = @SHELL@
1630 STRIP = @STRIP@
1631 VERSION = @VERSION@
1632+XINPUT_CFLAGS = @XINPUT_CFLAGS@
1633+XINPUT_LIBS = @XINPUT_LIBS@
1634 abs_builddir = @abs_builddir@
1635 abs_srcdir = @abs_srcdir@
1636 abs_top_builddir = @abs_top_builddir@
1637
1638=== modified file 'tools/Makefile.am'
1639--- tools/Makefile.am 2011-02-07 17:47:11 +0000
1640+++ tools/Makefile.am 2011-02-23 14:02:38 +0000
1641@@ -2,15 +2,31 @@
1642
1643 INCLUDES=-I$(top_srcdir)/include/
1644
1645-utouch_frame_test_mtdev_SOURCES = utouch-frame-test-mtdev.c
1646+utouch_frame_test_mtdev_SOURCES = common-defs.h utouch-frame-test-mtdev.c \
1647+ utouch-frame-test-mtdev.txt
1648 utouch_frame_test_mtdev_LDFLAGS = -L$(top_builddir)/src/.libs/ \
1649 -lutouch-frame -lutouch-evemu -lmtdev -lm
1650+local_manpages = utouch-frame-test-mtdev.1
1651+
1652+if HAVE_XI
1653+
1654+AM_CFLAGS = $(XINPUT_CFLAGS)
1655+
1656+bin_PROGRAMS += utouch-frame-test-xi2
1657+
1658+utouch_frame_test_xi2_SOURCES = common-defs.h utouch-frame-test-xi2.c \
1659+ utouch-frame-test-xi2.txt
1660+utouch_frame_test_xi2_LDFLAGS = $(XINPUT_LIBS) $(X11_LIBS) \
1661+ -L$(top_builddir)/src/.libs/ -lutouch-frame
1662+local_manpages += utouch-frame-test-xi2.1
1663+
1664+endif
1665
1666 if HAVE_DOCTOOLS
1667-dist_man_MANS = utouch-frame-test-mtdev.1
1668+dist_man_MANS = $(local_manpages)
1669
1670 %.1: %.txt
1671- $(ASCIIDOC) -f manpage --no-xmllint $<
1672+ $(ASCIIDOC) -f manpage $<
1673
1674 CLEANFILES = $(dist_man_MANS)
1675
1676
1677=== modified file 'tools/Makefile.in'
1678--- tools/Makefile.in 2011-02-07 17:47:11 +0000
1679+++ tools/Makefile.in 2011-02-23 14:02:38 +0000
1680@@ -34,7 +34,9 @@
1681 POST_UNINSTALL = :
1682 build_triplet = @build@
1683 host_triplet = @host@
1684-bin_PROGRAMS = utouch-frame-test-mtdev$(EXEEXT)
1685+bin_PROGRAMS = utouch-frame-test-mtdev$(EXEEXT) $(am__EXEEXT_1)
1686+@HAVE_XI_TRUE@am__append_1 = utouch-frame-test-xi2
1687+@HAVE_XI_TRUE@am__append_2 = utouch-frame-test-xi2.1
1688 subdir = tools
1689 DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.am \
1690 $(srcdir)/Makefile.in
1691@@ -46,6 +48,7 @@
1692 CONFIG_HEADER = $(top_builddir)/config.h
1693 CONFIG_CLEAN_FILES =
1694 CONFIG_CLEAN_VPATH_FILES =
1695+@HAVE_XI_TRUE@am__EXEEXT_1 = utouch-frame-test-xi2$(EXEEXT)
1696 am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
1697 PROGRAMS = $(bin_PROGRAMS)
1698 am_utouch_frame_test_mtdev_OBJECTS = \
1699@@ -56,6 +59,15 @@
1700 utouch_frame_test_mtdev_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
1701 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
1702 $(utouch_frame_test_mtdev_LDFLAGS) $(LDFLAGS) -o $@
1703+am__utouch_frame_test_xi2_SOURCES_DIST = common-defs.h \
1704+ utouch-frame-test-xi2.c utouch-frame-test-xi2.txt
1705+@HAVE_XI_TRUE@am_utouch_frame_test_xi2_OBJECTS = \
1706+@HAVE_XI_TRUE@ utouch-frame-test-xi2.$(OBJEXT)
1707+utouch_frame_test_xi2_OBJECTS = $(am_utouch_frame_test_xi2_OBJECTS)
1708+utouch_frame_test_xi2_LDADD = $(LDADD)
1709+utouch_frame_test_xi2_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
1710+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
1711+ $(utouch_frame_test_xi2_LDFLAGS) $(LDFLAGS) -o $@
1712 DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
1713 depcomp = $(SHELL) $(top_srcdir)/config-aux/depcomp
1714 am__depfiles_maybe = depfiles
1715@@ -69,8 +81,10 @@
1716 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
1717 --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
1718 $(LDFLAGS) -o $@
1719-SOURCES = $(utouch_frame_test_mtdev_SOURCES)
1720-DIST_SOURCES = $(utouch_frame_test_mtdev_SOURCES)
1721+SOURCES = $(utouch_frame_test_mtdev_SOURCES) \
1722+ $(utouch_frame_test_xi2_SOURCES)
1723+DIST_SOURCES = $(utouch_frame_test_mtdev_SOURCES) \
1724+ $(am__utouch_frame_test_xi2_SOURCES_DIST)
1725 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
1726 am__vpath_adj = case $$p in \
1727 $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
1728@@ -167,6 +181,8 @@
1729 SHELL = @SHELL@
1730 STRIP = @STRIP@
1731 VERSION = @VERSION@
1732+XINPUT_CFLAGS = @XINPUT_CFLAGS@
1733+XINPUT_LIBS = @XINPUT_LIBS@
1734 abs_builddir = @abs_builddir@
1735 abs_srcdir = @abs_srcdir@
1736 abs_top_builddir = @abs_top_builddir@
1737@@ -220,11 +236,21 @@
1738 top_builddir = @top_builddir@
1739 top_srcdir = @top_srcdir@
1740 INCLUDES = -I$(top_srcdir)/include/
1741-utouch_frame_test_mtdev_SOURCES = utouch-frame-test-mtdev.c
1742+utouch_frame_test_mtdev_SOURCES = common-defs.h utouch-frame-test-mtdev.c \
1743+ utouch-frame-test-mtdev.txt
1744+
1745 utouch_frame_test_mtdev_LDFLAGS = -L$(top_builddir)/src/.libs/ \
1746 -lutouch-frame -lutouch-evemu -lmtdev -lm
1747
1748-@HAVE_DOCTOOLS_TRUE@dist_man_MANS = utouch-frame-test-mtdev.1
1749+local_manpages = utouch-frame-test-mtdev.1 $(am__append_2)
1750+@HAVE_XI_TRUE@AM_CFLAGS = $(XINPUT_CFLAGS)
1751+@HAVE_XI_TRUE@utouch_frame_test_xi2_SOURCES = common-defs.h utouch-frame-test-xi2.c \
1752+@HAVE_XI_TRUE@ utouch-frame-test-xi2.txt
1753+
1754+@HAVE_XI_TRUE@utouch_frame_test_xi2_LDFLAGS = $(XINPUT_LIBS) $(X11_LIBS) \
1755+@HAVE_XI_TRUE@ -L$(top_builddir)/src/.libs/ -lutouch-frame
1756+
1757+@HAVE_DOCTOOLS_TRUE@dist_man_MANS = $(local_manpages)
1758 @HAVE_DOCTOOLS_TRUE@CLEANFILES = $(dist_man_MANS)
1759 all: all-am
1760
1761@@ -306,6 +332,9 @@
1762 utouch-frame-test-mtdev$(EXEEXT): $(utouch_frame_test_mtdev_OBJECTS) $(utouch_frame_test_mtdev_DEPENDENCIES)
1763 @rm -f utouch-frame-test-mtdev$(EXEEXT)
1764 $(utouch_frame_test_mtdev_LINK) $(utouch_frame_test_mtdev_OBJECTS) $(utouch_frame_test_mtdev_LDADD) $(LIBS)
1765+utouch-frame-test-xi2$(EXEEXT): $(utouch_frame_test_xi2_OBJECTS) $(utouch_frame_test_xi2_DEPENDENCIES)
1766+ @rm -f utouch-frame-test-xi2$(EXEEXT)
1767+ $(utouch_frame_test_xi2_LINK) $(utouch_frame_test_xi2_OBJECTS) $(utouch_frame_test_xi2_LDADD) $(LIBS)
1768
1769 mostlyclean-compile:
1770 -rm -f *.$(OBJEXT)
1771@@ -314,6 +343,7 @@
1772 -rm -f *.tab.c
1773
1774 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utouch-frame-test-mtdev.Po@am__quote@
1775+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utouch-frame-test-xi2.Po@am__quote@
1776
1777 .c.o:
1778 @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
1779@@ -599,7 +629,7 @@
1780
1781
1782 @HAVE_DOCTOOLS_TRUE@%.1: %.txt
1783-@HAVE_DOCTOOLS_TRUE@ $(ASCIIDOC) -f manpage --no-xmllint $<
1784+@HAVE_DOCTOOLS_TRUE@ $(ASCIIDOC) -f manpage $<
1785
1786 # Tell versions [3.59,3.63) of GNU make to not export all variables.
1787 # Otherwise a system limit (for SysV at least) may be exceeded.
1788
1789=== added file 'tools/common-defs.h'
1790--- tools/common-defs.h 1970-01-01 00:00:00 +0000
1791+++ tools/common-defs.h 2011-02-23 14:02:38 +0000
1792@@ -0,0 +1,85 @@
1793+/*****************************************************************************
1794+ *
1795+ * utouch-frame - Touch Frame Library
1796+ *
1797+ * Copyright (C) 2010-2011 Canonical Ltd.
1798+ *
1799+ * This program is free software: you can redistribute it and/or modify it
1800+ * under the terms of the GNU General Public License as published by the
1801+ * Free Software Foundation, either version 3 of the License, or (at your
1802+ * option) any later version.
1803+ *
1804+ * This program is distributed in the hope that it will be useful, but
1805+ * WITHOUT ANY WARRANTY; without even the implied warranty of
1806+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1807+ * General Public License for more details.
1808+ *
1809+ * You should have received a copy of the GNU General Public License along
1810+ * with this program. If not, see <http://www.gnu.org/licenses/>.
1811+ *
1812+ * Authors:
1813+ * Henrik Rydberg <rydberg@bitmath.org>
1814+ *
1815+ ****************************************************************************/
1816+
1817+static void report_device_caps(utouch_frame_handle fh)
1818+{
1819+ const struct utouch_surface *s = utouch_frame_get_surface(fh);
1820+
1821+ fprintf(stderr, "device props:\n");
1822+ if (s->needs_pointer)
1823+ fprintf(stderr, "\tpointer\n");
1824+ if (s->is_direct)
1825+ fprintf(stderr, "\tdirect\n");
1826+ if (s->is_buttonpad)
1827+ fprintf(stderr, "\tbuttonpad\n");
1828+ if (s->is_semi_mt)
1829+ fprintf(stderr, "\tsemi_mt\n");
1830+ fprintf(stderr, "device mt events:\n");
1831+ if (s->use_touch_major)
1832+ fprintf(stderr, "\ttouch_major\n");
1833+ if (s->use_touch_minor)
1834+ fprintf(stderr, "\ttouch_minor\n");
1835+ if (s->use_width_major)
1836+ fprintf(stderr, "\twidth_major\n");
1837+ if (s->use_width_minor)
1838+ fprintf(stderr, "\twidth_minor\n");
1839+ if (s->use_orientation)
1840+ fprintf(stderr, "\torientation\n");
1841+ if (s->use_pressure)
1842+ fprintf(stderr, "\tpressure\n");
1843+ if (s->use_distance)
1844+ fprintf(stderr, "\tdistance\n");
1845+}
1846+
1847+static void report_frame(const struct utouch_frame *frame)
1848+{
1849+ int i;
1850+
1851+ for (i = 0; i < frame->num_active; i++) {
1852+ const struct utouch_contact *t = frame->active[i];
1853+
1854+ fprintf(stderr, "touch %d\n", i);
1855+ fprintf(stderr, " slot: %d\n", t->slot);
1856+ fprintf(stderr, " id: %d\n", t->id);
1857+ fprintf(stderr, " tool_type: %d\n", t->tool_type);
1858+ fprintf(stderr, " x: %f\n", t->x);
1859+ fprintf(stderr, " y: %f\n", t->y);
1860+ fprintf(stderr, " touch_major: %f\n", t->touch_major);
1861+ fprintf(stderr, " touch_minor: %f\n", t->touch_minor);
1862+ fprintf(stderr, " width_major: %f\n", t->width_major);
1863+ fprintf(stderr, " width_minor: %f\n", t->width_minor);
1864+ fprintf(stderr, " angle: %f\n", t->orientation);
1865+ fprintf(stderr, " pressure: %f\n", t->pressure);
1866+ fprintf(stderr, " distance: %f\n", t->distance);
1867+ fprintf(stderr, " vx: %f\n", t->vx);
1868+ fprintf(stderr, " vy: %f\n", t->vy);
1869+ }
1870+
1871+ fprintf(stderr, "sync %d %ld %d %d %d\n",
1872+ frame->num_active,
1873+ frame->time,
1874+ frame->sequence_id,
1875+ frame->revision,
1876+ frame->slot_revision);
1877+}
1878
1879=== added file 'tools/utouch-frame-test-mtdev.1'
1880--- tools/utouch-frame-test-mtdev.1 1970-01-01 00:00:00 +0000
1881+++ tools/utouch-frame-test-mtdev.1 2011-02-23 14:02:38 +0000
1882@@ -0,0 +1,42 @@
1883+'\" t
1884+.\" Title: utouch-frame-test-mtdev
1885+.\" Author: [see the "AUTHOR" section]
1886+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
1887+.\" Date: 02/23/2011
1888+.\" Manual: \ \&
1889+.\" Source: \ \&
1890+.\" Language: English
1891+.\"
1892+.TH "UTOUCH\-FRAME\-TEST\" "1" "02/23/2011" "\ \&" "\ \&"
1893+.\" -----------------------------------------------------------------
1894+.\" * Define some portability stuff
1895+.\" -----------------------------------------------------------------
1896+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1897+.\" http://bugs.debian.org/507673
1898+.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
1899+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1900+.ie \n(.g .ds Aq \(aq
1901+.el .ds Aq '
1902+.\" -----------------------------------------------------------------
1903+.\" * set default formatting
1904+.\" -----------------------------------------------------------------
1905+.\" disable hyphenation
1906+.nh
1907+.\" disable justification (adjust text to left margin only)
1908+.ad l
1909+.\" -----------------------------------------------------------------
1910+.\" * MAIN CONTENT STARTS HERE *
1911+.\" -----------------------------------------------------------------
1912+.SH "NAME"
1913+utouch-frame-test-mtdev \- describe a device and report frame events
1914+.SH "SYNOPSIS"
1915+.sp
1916+.nf
1917+utouch\-frame\-test\-mtdev device
1918+.fi
1919+.SH "DESCRIPTION"
1920+.sp
1921+A test tool used to analyse the capabilities and act as a test driver for the uTouch touch frame library\&.
1922+.SH "AUTHOR"
1923+.sp
1924+utouch\-frame\-test\-mtdev was written by Henrik Rydberg <rydberg@euromail\&.se>
1925
1926=== modified file 'tools/utouch-frame-test-mtdev.c'
1927--- tools/utouch-frame-test-mtdev.c 2010-12-30 19:26:42 +0000
1928+++ tools/utouch-frame-test-mtdev.c 2011-02-23 14:02:38 +0000
1929@@ -30,6 +30,7 @@
1930 #include <stdio.h>
1931 #include <unistd.h>
1932 #include <fcntl.h>
1933+#include "common-defs.h"
1934
1935 struct frame_test {
1936 struct evemu_device *evemu;
1937@@ -69,36 +70,6 @@
1938 memset(test, 0, sizeof(*test));
1939 }
1940
1941-static void report_frame(const struct utouch_frame *frame)
1942-{
1943- int i;
1944-
1945- for (i = 0; i < frame->num_active; i++) {
1946- const struct utouch_contact *t = frame->active[i];
1947-
1948- fprintf(stderr, "touch %d\n", i);
1949- fprintf(stderr, " slot: %d\n", t->slot);
1950- fprintf(stderr, " id: %d\n", t->id);
1951- fprintf(stderr, " tool_type: %d\n", t->tool_type);
1952- fprintf(stderr, " x: %f\n", t->x);
1953- fprintf(stderr, " y: %f\n", t->y);
1954- fprintf(stderr, " touch_major: %f\n", t->touch_major);
1955- fprintf(stderr, " touch_minor: %f\n", t->touch_minor);
1956- fprintf(stderr, " width_major: %f\n", t->width_major);
1957- fprintf(stderr, " width_minor: %f\n", t->width_minor);
1958- fprintf(stderr, " angle: %f\n", t->orientation);
1959- fprintf(stderr, " pressure: %f\n", t->pressure);
1960- fprintf(stderr, " distance: %f\n", t->distance);
1961- }
1962-
1963- fprintf(stderr, "sync %d %ld %d %d %d\n",
1964- frame->num_active,
1965- frame->time,
1966- frame->sequence_id,
1967- frame->revision,
1968- frame->slot_revision);
1969-}
1970-
1971 static void loop_device(struct frame_test *test, int fd)
1972 {
1973 const struct utouch_frame *frame;
1974@@ -113,46 +84,6 @@
1975 }
1976 }
1977
1978-static void report_device_caps(struct frame_test *test)
1979-{
1980-#ifdef INPUT_PROP_POINTER
1981- fprintf(stderr, "device props:\n");
1982- if (evemu_has_prop(test->evemu, INPUT_PROP_POINTER))
1983- fprintf(stderr, "\tpointer\n");
1984- if (evemu_has_prop(test->evemu, INPUT_PROP_DIRECT))
1985- fprintf(stderr, "\tdirect\n");
1986- if (evemu_has_prop(test->evemu, INPUT_PROP_BUTTONPAD))
1987- fprintf(stderr, "\tbuttonpad\n");
1988- if (evemu_has_prop(test->evemu, INPUT_PROP_SEMI_MT))
1989- fprintf(stderr, "\tsemi_mt\n");
1990-#endif
1991- fprintf(stderr, "device mt events:\n");
1992- if (evemu_has_event(test->evemu, EV_ABS, ABS_MT_SLOT))
1993- fprintf(stderr, "\tslot\n");
1994- if (evemu_has_event(test->evemu, EV_ABS, ABS_MT_TOUCH_MAJOR))
1995- fprintf(stderr, "\ttouch_major\n");
1996- if (evemu_has_event(test->evemu, EV_ABS, ABS_MT_TOUCH_MINOR))
1997- fprintf(stderr, "\ttouch_minor\n");
1998- if (evemu_has_event(test->evemu, EV_ABS, ABS_MT_WIDTH_MAJOR))
1999- fprintf(stderr, "\twidth_major\n");
2000- if (evemu_has_event(test->evemu, EV_ABS, ABS_MT_WIDTH_MINOR))
2001- fprintf(stderr, "\twidth_minor\n");
2002- if (evemu_has_event(test->evemu, EV_ABS, ABS_MT_ORIENTATION))
2003- fprintf(stderr, "\torientation\n");
2004- if (evemu_has_event(test->evemu, EV_ABS, ABS_MT_POSITION_X))
2005- fprintf(stderr, "\tposition_x\n");
2006- if (evemu_has_event(test->evemu, EV_ABS, ABS_MT_POSITION_Y))
2007- fprintf(stderr, "\tposition_y\n");
2008- if (evemu_has_event(test->evemu, EV_ABS, ABS_MT_TOOL_TYPE))
2009- fprintf(stderr, "\tposition_y\n");
2010- if (evemu_has_event(test->evemu, EV_ABS, ABS_MT_TRACKING_ID))
2011- fprintf(stderr, "\ttracking_id\n");
2012- if (evemu_has_event(test->evemu, EV_ABS, ABS_MT_PRESSURE))
2013- fprintf(stderr, "\tpressure\n");
2014- if (evemu_has_event(test->evemu, EV_ABS, ABS_MT_DISTANCE))
2015- fprintf(stderr, "\tdistance\n");
2016-}
2017-
2018 int main(int argc, char *argv[])
2019 {
2020 struct frame_test test;
2021@@ -193,7 +124,7 @@
2022 return -1;
2023 }
2024
2025- report_device_caps(&test);
2026+ report_device_caps(test.fh);
2027
2028 loop_device(&test, fd);
2029
2030
2031=== added file 'tools/utouch-frame-test-xi2.1'
2032--- tools/utouch-frame-test-xi2.1 1970-01-01 00:00:00 +0000
2033+++ tools/utouch-frame-test-xi2.1 2011-02-23 14:02:38 +0000
2034@@ -0,0 +1,42 @@
2035+'\" t
2036+.\" Title: utouch-frame-test-xi2
2037+.\" Author: [see the "AUTHOR" section]
2038+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
2039+.\" Date: 02/23/2011
2040+.\" Manual: \ \&
2041+.\" Source: \ \&
2042+.\" Language: English
2043+.\"
2044+.TH "UTOUCH\-FRAME\-TEST\" "1" "02/23/2011" "\ \&" "\ \&"
2045+.\" -----------------------------------------------------------------
2046+.\" * Define some portability stuff
2047+.\" -----------------------------------------------------------------
2048+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2049+.\" http://bugs.debian.org/507673
2050+.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
2051+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2052+.ie \n(.g .ds Aq \(aq
2053+.el .ds Aq '
2054+.\" -----------------------------------------------------------------
2055+.\" * set default formatting
2056+.\" -----------------------------------------------------------------
2057+.\" disable hyphenation
2058+.nh
2059+.\" disable justification (adjust text to left margin only)
2060+.ad l
2061+.\" -----------------------------------------------------------------
2062+.\" * MAIN CONTENT STARTS HERE *
2063+.\" -----------------------------------------------------------------
2064+.SH "NAME"
2065+utouch-frame-test-xi2 \- report frame events from an xinput device
2066+.SH "SYNOPSIS"
2067+.sp
2068+.nf
2069+utouch\-frame\-test\-xi2 xinput\-device\-number
2070+.fi
2071+.SH "DESCRIPTION"
2072+.sp
2073+A test tool used to analyse the capabilities and act as a test driver for the uTouch touch frame library\&.
2074+.SH "AUTHOR"
2075+.sp
2076+utouch\-frame\-test\-xi2 was written by Henrik Rydberg <rydberg@euromail\&.se>
2077
2078=== added file 'tools/utouch-frame-test-xi2.c'
2079--- tools/utouch-frame-test-xi2.c 1970-01-01 00:00:00 +0000
2080+++ tools/utouch-frame-test-xi2.c 2011-02-23 14:02:38 +0000
2081@@ -0,0 +1,177 @@
2082+/*****************************************************************************
2083+ *
2084+ * utouch-frame - Touch Frame Library
2085+ *
2086+ * Copyright (C) 2010-2011 Canonical Ltd.
2087+ *
2088+ * This program is free software: you can redistribute it and/or modify it
2089+ * under the terms of the GNU General Public License as published by the
2090+ * Free Software Foundation, either version 3 of the License, or (at your
2091+ * option) any later version.
2092+ *
2093+ * This program is distributed in the hope that it will be useful, but
2094+ * WITHOUT ANY WARRANTY; without even the implied warranty of
2095+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2096+ * General Public License for more details.
2097+ *
2098+ * You should have received a copy of the GNU General Public License along
2099+ * with this program. If not, see <http://www.gnu.org/licenses/>.
2100+ *
2101+ * Authors:
2102+ * Henrik Rydberg <rydberg@bitmath.org>
2103+ *
2104+ ****************************************************************************/
2105+
2106+#define MTDEV_NO_LEGACY_API
2107+
2108+#include <utouch/frame-xi2.h>
2109+#include <string.h>
2110+#include <stdio.h>
2111+#include <unistd.h>
2112+#include <fcntl.h>
2113+#include <stdlib.h>
2114+#include "common-defs.h"
2115+
2116+static int opcode;
2117+
2118+struct frame_test {
2119+ Display *display;
2120+ Window root, win;
2121+ XIDeviceInfo *info, *dev;
2122+ utouch_frame_handle fh;
2123+};
2124+
2125+static int init_xi2(struct frame_test *test, int id)
2126+{
2127+ Display *dpy;
2128+ int ndevices, i;
2129+ int event, error;
2130+
2131+ dpy = XOpenDisplay(NULL);
2132+ if (!dpy)
2133+ return -1;
2134+
2135+ if (!XQueryExtension(dpy, "XInputExtension", &opcode, &event, &error))
2136+ return -1;
2137+
2138+ test->display = dpy;
2139+ test->info = XIQueryDevice(dpy, XIAllDevices, &ndevices);
2140+ test->dev = 0;
2141+ for (i = 0; i < ndevices; i++)
2142+ if (test->info[i].deviceid == id)
2143+ test->dev = &test->info[i];
2144+ if (!test->dev)
2145+ return -1;
2146+
2147+ test->root = DefaultRootWindow(dpy);
2148+ test->win = XCreateSimpleWindow(dpy, test->root,
2149+ 0, 0, 400, 400, 0,
2150+ BlackPixel(dpy, 0),
2151+ WhitePixel(dpy, 0));
2152+
2153+ XMapWindow(test->display, test->win);
2154+ XFlush(test->display);
2155+
2156+ return 0;
2157+}
2158+
2159+static int init_frame(struct frame_test *test)
2160+{
2161+ test->fh = utouch_frame_new_engine(100, 32, 100);
2162+ if (!test->fh)
2163+ return -1;
2164+ return utouch_frame_init_xi2(test->fh, test->display, test->dev);
2165+}
2166+
2167+static void destroy_all(struct frame_test *test)
2168+{
2169+ utouch_frame_delete_engine(test->fh);
2170+ XIFreeDeviceInfo(test->info);
2171+ XDestroyWindow(test->display, test->win);
2172+ XCloseDisplay(test->display);
2173+ memset(test, 0, sizeof(*test));
2174+}
2175+
2176+static void handle_event(struct frame_test *test, XEvent *ev)
2177+{
2178+ XGenericEventCookie *gev = &ev->xcookie;
2179+ const struct utouch_frame *frame;
2180+ XConfigureEvent *cev;
2181+ XIDeviceEvent *dev;
2182+
2183+ switch(ev->type) {
2184+ case ConfigureNotify:
2185+ cev = (XConfigureEvent *)ev;
2186+ if (cev->window == XDefaultRootWindow(cev->display))
2187+ utouch_frame_configure_xi2(test->fh, cev);
2188+ break;
2189+ case GenericEvent:
2190+ if (!XGetEventData(test->display, gev))
2191+ break;
2192+ dev = gev->data;
2193+ /* null for some requests, quite odd */
2194+ dev->display = ev->xany.display;
2195+ if (gev->type == GenericEvent && gev->extension == opcode) {
2196+ frame = utouch_frame_pump_xi2(test->fh, dev);
2197+ if (frame)
2198+ report_frame(frame);
2199+ }
2200+ XFreeEventData(test->display, gev);
2201+ break;
2202+ }
2203+}
2204+
2205+static void loop_device(struct frame_test *test)
2206+{
2207+ XIEventMask mask;
2208+
2209+ mask.deviceid = XIAllDevices;
2210+ mask.mask_len = XIMaskLen(XI_LASTEVENT);
2211+ mask.mask = calloc(mask.mask_len, sizeof(char));
2212+
2213+ XISetMask(mask.mask, XI_TouchBegin);
2214+ XISetMask(mask.mask, XI_TouchUpdate);
2215+ XISetMask(mask.mask, XI_TouchEnd);
2216+ XISetMask(mask.mask, XI_PropertyEvent);
2217+ XISelectEvents(test->display, test->win, &mask, 1);
2218+
2219+ XSelectInput(test->display, test->root, StructureNotifyMask);
2220+
2221+ while (1) {
2222+ XEvent ev;
2223+ XNextEvent(test->display, &ev);
2224+ handle_event(test, &ev);
2225+ }
2226+}
2227+
2228+int main(int argc, char *argv[])
2229+{
2230+ struct frame_test test;
2231+ int id;
2232+
2233+ if (argc < 2) {
2234+ fprintf(stderr, "Usage: %s <xinput_device_number>\n", argv[0]);
2235+ return -1;
2236+ }
2237+ id = atoi(argv[1]);
2238+
2239+ if (init_xi2(&test, id)) {
2240+ fprintf(stderr, "error: could not describe device\n");
2241+ return -1;
2242+ }
2243+ if (!utouch_frame_is_supported_xi2(test.display, test.dev)) {
2244+ fprintf(stderr, "error: unsupported device\n");
2245+ return -1;
2246+ }
2247+ if (init_frame(&test)) {
2248+ fprintf(stderr, "error: could not init frame\n");
2249+ return -1;
2250+ }
2251+
2252+ report_device_caps(test.fh);
2253+
2254+ loop_device(&test);
2255+
2256+ destroy_all(&test);
2257+ return 0;
2258+}
2259
2260=== added file 'tools/utouch-frame-test-xi2.txt'
2261--- tools/utouch-frame-test-xi2.txt 1970-01-01 00:00:00 +0000
2262+++ tools/utouch-frame-test-xi2.txt 2011-02-23 14:02:38 +0000
2263@@ -0,0 +1,22 @@
2264+UTOUCH-FRAME-TEST-XI2(1)
2265+==========================
2266+
2267+NAME
2268+----
2269+
2270+ utouch-frame-test-xi2 - report frame events from an xinput device
2271+
2272+SYNOPSIS
2273+--------
2274+
2275+ utouch-frame-test-xi2 xinput-device-number
2276+
2277+DESCRIPTION
2278+-----------
2279+
2280+A test tool used to analyse the capabilities and act as a test driver for the
2281+uTouch touch frame library.
2282+
2283+AUTHOR
2284+------
2285+utouch-frame-test-xi2 was written by Henrik Rydberg <rydberg@euromail.se>

Subscribers

People subscribed via source and target branches

to all changes: