Merge lp:~dandrader/frame/release_2.4.3-0ubuntu1 into lp:frame/ubuntu
- release_2.4.3-0ubuntu1
- Merge into ubuntu
Proposed by
Daniel d'Andrada
Status: | Merged |
---|---|
Approved by: | Stephen M. Webb |
Approved revision: | 86 |
Merged at revision: | 86 |
Proposed branch: | lp:~dandrader/frame/release_2.4.3-0ubuntu1 |
Merge into: | lp:frame/ubuntu |
Diff against target: |
2035 lines (+1137/-190) 35 files modified
INSTALL (+2/-2) Makefile.in (+2/-2) aclocal.m4 (+3/-3) config-aux/ltmain.sh (+2/-2) configure (+18/-124) configure.ac (+1/-4) debian/changelog (+7/-2) debian/libframe6.symbols (+35/-0) doc/Makefile.in (+1/-1) include/oif/frame.h (+1/-0) include/oif/frame_backend.h (+291/-0) src/Makefile.am (+1/-2) src/Makefile.in (+3/-4) src/device.cpp (+93/-6) src/device.h (+7/-1) src/event.cpp (+37/-0) src/event.h (+1/-0) src/frame.cpp (+142/-17) src/frame.h (+12/-3) src/libframe.ver (+39/-0) src/touch.cpp (+96/-0) src/touch.h (+19/-3) src/window.h (+1/-1) src/x11/device_x11.cpp (+0/-3) src/x11/window_x11.cpp (+2/-2) test/Makefile.in (+1/-1) test/gtest/Makefile.in (+1/-1) test/integration/Makefile.in (+1/-1) test/regular/Makefile.am (+1/-0) test/regular/Makefile.in (+18/-1) test/regular/backend.cpp (+289/-0) test/regular/frame-fixture.cpp (+6/-0) test/x11_mocks/Makefile.in (+1/-1) tools/Makefile.in (+1/-1) tools/frame-test-x11.1 (+2/-2) |
To merge this branch: | bzr merge lp:~dandrader/frame/release_2.4.3-0ubuntu1 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Stephen M. Webb (community) | Approve | ||
Review via email: mp+133514@code.launchpad.net |
Commit message
Description of the change
Release 2.4.3-0ubuntu1
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'INSTALL' |
2 | --- INSTALL 2012-07-26 18:35:10 +0000 |
3 | +++ INSTALL 2012-11-08 16:29:22 +0000 |
4 | @@ -1,7 +1,7 @@ |
5 | frame - Touch Frame Library |
6 | |
7 | -To build, you need to have the autoconf, libtool, libevemu-dev |
8 | -and mtdev-dev packages installed. Then, do |
9 | +To build, you need to have the autoconf, libtool, and x11 developer |
10 | +packages installed. Then, do |
11 | |
12 | ./autogen.sh |
13 | ./configure |
14 | |
15 | === modified file 'Makefile.in' |
16 | --- Makefile.in 2012-07-26 18:35:10 +0000 |
17 | +++ Makefile.in 2012-11-08 16:29:22 +0000 |
18 | @@ -1,4 +1,4 @@ |
19 | -# Makefile.in generated by automake 1.11.5 from Makefile.am. |
20 | +# Makefile.in generated by automake 1.11.6 from Makefile.am. |
21 | # @configure_input@ |
22 | |
23 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, |
24 | @@ -691,7 +691,7 @@ |
25 | *.zip*) \ |
26 | unzip $(distdir).zip ;;\ |
27 | esac |
28 | - chmod -R a-w $(distdir); chmod a+w $(distdir) |
29 | + chmod -R a-w $(distdir); chmod u+w $(distdir) |
30 | mkdir $(distdir)/_build |
31 | mkdir $(distdir)/_inst |
32 | chmod a-w $(distdir) |
33 | |
34 | === modified file 'aclocal.m4' |
35 | --- aclocal.m4 2012-07-26 18:35:10 +0000 |
36 | +++ aclocal.m4 2012-11-08 16:29:22 +0000 |
37 | @@ -1,4 +1,4 @@ |
38 | -# generated automatically by aclocal 1.11.5 -*- Autoconf -*- |
39 | +# generated automatically by aclocal 1.11.6 -*- Autoconf -*- |
40 | |
41 | # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, |
42 | # 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, |
43 | @@ -38,7 +38,7 @@ |
44 | [am__api_version='1.11' |
45 | dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to |
46 | dnl require some minimum version. Point them to the right macro. |
47 | -m4_if([$1], [1.11.5], [], |
48 | +m4_if([$1], [1.11.6], [], |
49 | [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl |
50 | ]) |
51 | |
52 | @@ -54,7 +54,7 @@ |
53 | # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. |
54 | # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. |
55 | AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], |
56 | -[AM_AUTOMAKE_VERSION([1.11.5])dnl |
57 | +[AM_AUTOMAKE_VERSION([1.11.6])dnl |
58 | m4_ifndef([AC_AUTOCONF_VERSION], |
59 | [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl |
60 | _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) |
61 | |
62 | === modified file 'config-aux/ltmain.sh' |
63 | --- config-aux/ltmain.sh 2012-01-30 22:35:59 +0000 |
64 | +++ config-aux/ltmain.sh 2012-11-08 16:29:22 +0000 |
65 | @@ -70,7 +70,7 @@ |
66 | # compiler: $LTCC |
67 | # compiler flags: $LTCFLAGS |
68 | # linker: $LD (gnu? $with_gnu_ld) |
69 | -# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1ubuntu1 |
70 | +# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1ubuntu2 |
71 | # automake: $automake_version |
72 | # autoconf: $autoconf_version |
73 | # |
74 | @@ -80,7 +80,7 @@ |
75 | |
76 | PROGRAM=libtool |
77 | PACKAGE=libtool |
78 | -VERSION="2.4.2 Debian-2.4.2-1ubuntu1" |
79 | +VERSION="2.4.2 Debian-2.4.2-1ubuntu2" |
80 | TIMESTAMP="" |
81 | package_revision=1.3337 |
82 | |
83 | |
84 | === modified file 'configure' |
85 | --- configure 2012-07-26 18:43:01 +0000 |
86 | +++ configure 2012-11-08 16:29:22 +0000 |
87 | @@ -1,6 +1,6 @@ |
88 | #! /bin/sh |
89 | # Guess values for system-dependent variables and create Makefiles. |
90 | -# Generated by GNU Autoconf 2.69 for Touch Frame Library 2.2.4. |
91 | +# Generated by GNU Autoconf 2.69 for Touch Frame Library 2.4.3. |
92 | # |
93 | # |
94 | # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. |
95 | @@ -587,8 +587,8 @@ |
96 | # Identity of this package. |
97 | PACKAGE_NAME='Touch Frame Library' |
98 | PACKAGE_TARNAME='frame' |
99 | -PACKAGE_VERSION='2.2.4' |
100 | -PACKAGE_STRING='Touch Frame Library 2.2.4' |
101 | +PACKAGE_VERSION='2.4.3' |
102 | +PACKAGE_STRING='Touch Frame Library 2.4.3' |
103 | PACKAGE_BUGREPORT='' |
104 | PACKAGE_URL='' |
105 | |
106 | @@ -670,6 +670,8 @@ |
107 | BASE_CXXFLAGS |
108 | XORG_GTEST_CPPFLAGS |
109 | XORG_GTEST_SOURCE |
110 | +EVEMU_LIBS |
111 | +EVEMU_CFLAGS |
112 | X11_LIBS |
113 | X11_CFLAGS |
114 | HAVE_GTEST_FALSE |
115 | @@ -682,10 +684,6 @@ |
116 | ASCIIDOC |
117 | XINPUT_LIBS |
118 | XINPUT_CFLAGS |
119 | -HAVE_EVEMU_FALSE |
120 | -HAVE_EVEMU_TRUE |
121 | -EVEMU_LIBS |
122 | -EVEMU_CFLAGS |
123 | PKG_CONFIG_LIBDIR |
124 | PKG_CONFIG_PATH |
125 | PKG_CONFIG |
126 | @@ -849,12 +847,12 @@ |
127 | PKG_CONFIG |
128 | PKG_CONFIG_PATH |
129 | PKG_CONFIG_LIBDIR |
130 | -EVEMU_CFLAGS |
131 | -EVEMU_LIBS |
132 | XINPUT_CFLAGS |
133 | XINPUT_LIBS |
134 | X11_CFLAGS |
135 | -X11_LIBS' |
136 | +X11_LIBS |
137 | +EVEMU_CFLAGS |
138 | +EVEMU_LIBS' |
139 | |
140 | |
141 | # Initialize some variables set by options. |
142 | @@ -1395,7 +1393,7 @@ |
143 | # Omit some internal or obsolete options to make the list less imposing. |
144 | # This message is too long to be a string in the A/UX 3.1 sh. |
145 | cat <<_ACEOF |
146 | -\`configure' configures Touch Frame Library 2.2.4 to adapt to many kinds of systems. |
147 | +\`configure' configures Touch Frame Library 2.4.3 to adapt to many kinds of systems. |
148 | |
149 | Usage: $0 [OPTION]... [VAR=VALUE]... |
150 | |
151 | @@ -1465,7 +1463,7 @@ |
152 | |
153 | if test -n "$ac_init_help"; then |
154 | case $ac_init_help in |
155 | - short | recursive ) echo "Configuration of Touch Frame Library 2.2.4:";; |
156 | + short | recursive ) echo "Configuration of Touch Frame Library 2.4.3:";; |
157 | esac |
158 | cat <<\_ACEOF |
159 | |
160 | @@ -1528,14 +1526,14 @@ |
161 | directories to add to pkg-config's search path |
162 | PKG_CONFIG_LIBDIR |
163 | path overriding pkg-config's built-in search path |
164 | - EVEMU_CFLAGS |
165 | - C compiler flags for EVEMU, overriding pkg-config |
166 | - EVEMU_LIBS linker flags for EVEMU, overriding pkg-config |
167 | XINPUT_CFLAGS |
168 | C compiler flags for XINPUT, overriding pkg-config |
169 | XINPUT_LIBS linker flags for XINPUT, overriding pkg-config |
170 | X11_CFLAGS C compiler flags for X11, overriding pkg-config |
171 | X11_LIBS linker flags for X11, overriding pkg-config |
172 | + EVEMU_CFLAGS |
173 | + C compiler flags for EVEMU, overriding pkg-config |
174 | + EVEMU_LIBS linker flags for EVEMU, overriding pkg-config |
175 | |
176 | Use these variables to override the choices made by `configure' or to help |
177 | it to find libraries and programs with nonstandard names/locations. |
178 | @@ -1603,7 +1601,7 @@ |
179 | test -n "$ac_init_help" && exit $ac_status |
180 | if $ac_init_version; then |
181 | cat <<\_ACEOF |
182 | -Touch Frame Library configure 2.2.4 |
183 | +Touch Frame Library configure 2.4.3 |
184 | generated by GNU Autoconf 2.69 |
185 | |
186 | Copyright (C) 2012 Free Software Foundation, Inc. |
187 | @@ -2048,7 +2046,7 @@ |
188 | This file contains any messages produced by compilers while |
189 | running configure, to aid debugging if configure makes a mistake. |
190 | |
191 | -It was created by Touch Frame Library $as_me 2.2.4, which was |
192 | +It was created by Touch Frame Library $as_me 2.4.3, which was |
193 | generated by GNU Autoconf 2.69. Invocation command line was |
194 | |
195 | $ $0 $@ |
196 | @@ -2869,7 +2867,7 @@ |
197 | |
198 | # Define the identity of the package. |
199 | PACKAGE='frame' |
200 | - VERSION='2.2.4' |
201 | + VERSION='2.4.3' |
202 | |
203 | |
204 | cat >>confdefs.h <<_ACEOF |
205 | @@ -15946,106 +15944,6 @@ |
206 | fi |
207 | |
208 | pkg_failed=no |
209 | -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for EVEMU" >&5 |
210 | -$as_echo_n "checking for EVEMU... " >&6; } |
211 | - |
212 | -if test -n "$EVEMU_CFLAGS"; then |
213 | - pkg_cv_EVEMU_CFLAGS="$EVEMU_CFLAGS" |
214 | - elif test -n "$PKG_CONFIG"; then |
215 | - if test -n "$PKG_CONFIG" && \ |
216 | - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"evemu >= 1.0.5\""; } >&5 |
217 | - ($PKG_CONFIG --exists --print-errors "evemu >= 1.0.5") 2>&5 |
218 | - ac_status=$? |
219 | - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 |
220 | - test $ac_status = 0; }; then |
221 | - pkg_cv_EVEMU_CFLAGS=`$PKG_CONFIG --cflags "evemu >= 1.0.5" 2>/dev/null` |
222 | - test "x$?" != "x0" && pkg_failed=yes |
223 | -else |
224 | - pkg_failed=yes |
225 | -fi |
226 | - else |
227 | - pkg_failed=untried |
228 | -fi |
229 | -if test -n "$EVEMU_LIBS"; then |
230 | - pkg_cv_EVEMU_LIBS="$EVEMU_LIBS" |
231 | - elif test -n "$PKG_CONFIG"; then |
232 | - if test -n "$PKG_CONFIG" && \ |
233 | - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"evemu >= 1.0.5\""; } >&5 |
234 | - ($PKG_CONFIG --exists --print-errors "evemu >= 1.0.5") 2>&5 |
235 | - ac_status=$? |
236 | - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 |
237 | - test $ac_status = 0; }; then |
238 | - pkg_cv_EVEMU_LIBS=`$PKG_CONFIG --libs "evemu >= 1.0.5" 2>/dev/null` |
239 | - test "x$?" != "x0" && pkg_failed=yes |
240 | -else |
241 | - pkg_failed=yes |
242 | -fi |
243 | - else |
244 | - pkg_failed=untried |
245 | -fi |
246 | - |
247 | - |
248 | - |
249 | -if test $pkg_failed = yes; then |
250 | - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 |
251 | -$as_echo "no" >&6; } |
252 | - |
253 | -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then |
254 | - _pkg_short_errors_supported=yes |
255 | -else |
256 | - _pkg_short_errors_supported=no |
257 | -fi |
258 | - if test $_pkg_short_errors_supported = yes; then |
259 | - EVEMU_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "evemu >= 1.0.5" 2>&1` |
260 | - else |
261 | - EVEMU_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "evemu >= 1.0.5" 2>&1` |
262 | - fi |
263 | - # Put the nasty error message in config.log where it belongs |
264 | - echo "$EVEMU_PKG_ERRORS" >&5 |
265 | - |
266 | - as_fn_error $? "Package requirements (evemu >= 1.0.5) were not met: |
267 | - |
268 | -$EVEMU_PKG_ERRORS |
269 | - |
270 | -Consider adjusting the PKG_CONFIG_PATH environment variable if you |
271 | -installed software in a non-standard prefix. |
272 | - |
273 | -Alternatively, you may set the environment variables EVEMU_CFLAGS |
274 | -and EVEMU_LIBS to avoid the need to call pkg-config. |
275 | -See the pkg-config man page for more details." "$LINENO" 5 |
276 | -elif test $pkg_failed = untried; then |
277 | - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 |
278 | -$as_echo "no" >&6; } |
279 | - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 |
280 | -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} |
281 | -as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it |
282 | -is in your PATH or set the PKG_CONFIG environment variable to the full |
283 | -path to pkg-config. |
284 | - |
285 | -Alternatively, you may set the environment variables EVEMU_CFLAGS |
286 | -and EVEMU_LIBS to avoid the need to call pkg-config. |
287 | -See the pkg-config man page for more details. |
288 | - |
289 | -To get pkg-config, see <http://pkg-config.freedesktop.org/>. |
290 | -See \`config.log' for more details" "$LINENO" 5; } |
291 | -else |
292 | - EVEMU_CFLAGS=$pkg_cv_EVEMU_CFLAGS |
293 | - EVEMU_LIBS=$pkg_cv_EVEMU_LIBS |
294 | - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 |
295 | -$as_echo "yes" >&6; } |
296 | - have_evemu=yes |
297 | -fi |
298 | - if test "x$have_evemu" = xyes; then |
299 | - HAVE_EVEMU_TRUE= |
300 | - HAVE_EVEMU_FALSE='#' |
301 | -else |
302 | - HAVE_EVEMU_TRUE='#' |
303 | - HAVE_EVEMU_FALSE= |
304 | -fi |
305 | - |
306 | - |
307 | - |
308 | -pkg_failed=no |
309 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XINPUT" >&5 |
310 | $as_echo_n "checking for XINPUT... " >&6; } |
311 | |
312 | @@ -22245,10 +22143,6 @@ |
313 | as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. |
314 | Usually this means the macro was only invoked conditionally." "$LINENO" 5 |
315 | fi |
316 | -if test -z "${HAVE_EVEMU_TRUE}" && test -z "${HAVE_EVEMU_FALSE}"; then |
317 | - as_fn_error $? "conditional \"HAVE_EVEMU\" was never defined. |
318 | -Usually this means the macro was only invoked conditionally." "$LINENO" 5 |
319 | -fi |
320 | if test -z "${HAVE_DOCTOOLS_TRUE}" && test -z "${HAVE_DOCTOOLS_FALSE}"; then |
321 | as_fn_error $? "conditional \"HAVE_DOCTOOLS\" was never defined. |
322 | Usually this means the macro was only invoked conditionally." "$LINENO" 5 |
323 | @@ -22662,7 +22556,7 @@ |
324 | # report actual input values of CONFIG_FILES etc. instead of their |
325 | # values after options handling. |
326 | ac_log=" |
327 | -This file was extended by Touch Frame Library $as_me 2.2.4, which was |
328 | +This file was extended by Touch Frame Library $as_me 2.4.3, which was |
329 | generated by GNU Autoconf 2.69. Invocation command line was |
330 | |
331 | CONFIG_FILES = $CONFIG_FILES |
332 | @@ -22728,7 +22622,7 @@ |
333 | cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 |
334 | ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" |
335 | ac_cs_version="\\ |
336 | -Touch Frame Library config.status 2.2.4 |
337 | +Touch Frame Library config.status 2.4.3 |
338 | configured by $0, generated by GNU Autoconf 2.69, |
339 | with options \\"\$ac_cs_config\\" |
340 | |
341 | |
342 | === modified file 'configure.ac' |
343 | --- configure.ac 2012-07-26 18:35:10 +0000 |
344 | +++ configure.ac 2012-11-08 16:29:22 +0000 |
345 | @@ -1,7 +1,7 @@ |
346 | # Initialize Autoconf |
347 | AC_PREREQ([2.60]) |
348 | AC_INIT([Touch Frame Library], |
349 | - [2.2.4], |
350 | + [2.4.3], |
351 | [], |
352 | [frame]) |
353 | AC_CONFIG_SRCDIR([Makefile.am]) |
354 | @@ -25,9 +25,6 @@ |
355 | AC_PROG_CXX |
356 | AC_PROG_INSTALL |
357 | |
358 | -PKG_CHECK_MODULES([EVEMU], [evemu >= 1.0.5], [have_evemu=yes]) |
359 | -AM_CONDITIONAL([HAVE_EVEMU], [test "x$have_evemu" = xyes]) |
360 | - |
361 | PKG_CHECK_MODULES(XINPUT, x11 xext xorg-server [xi >= 1.5.99.1] [inputproto >= 2.1.99.6]) |
362 | |
363 | AC_CHECK_PROG([ASCIIDOC], [a2x], [a2x]) |
364 | |
365 | === modified file 'debian/changelog' |
366 | --- debian/changelog 2012-08-29 21:32:21 +0000 |
367 | +++ debian/changelog 2012-11-08 16:29:22 +0000 |
368 | @@ -1,9 +1,14 @@ |
369 | -frame (2.2.4-0ubuntu2) UNRELEASED; urgency=low |
370 | +frame (2.4.3-0ubuntu1) raring; urgency=low |
371 | |
372 | + [ Chase Douglas ] |
373 | * Remove patches, both have been merged upstream |
374 | * Replace wrong "Multi-arch" with correct "Multi-Arch" in debian/control |
375 | |
376 | - -- Chase Douglas <chase.douglas@ubuntu.com> Wed, 29 Aug 2012 21:31:11 +0000 |
377 | + [ Daniel d'Andrada ] |
378 | + * New upstream release. |
379 | + * Updated libframe6.symbols with the new symbols from version 2.4 |
380 | + |
381 | + -- Daniel d'Andrada <daniel.dandrada@canonical.com> Thu, 08 Nov 2012 14:14:13 -0200 |
382 | |
383 | frame (2.2.4-0ubuntu1) quantal; urgency=low |
384 | |
385 | |
386 | === modified file 'debian/libframe6.symbols' |
387 | --- debian/libframe6.symbols 2012-07-26 18:56:37 +0000 |
388 | +++ debian/libframe6.symbols 2012-11-08 16:29:22 +0000 |
389 | @@ -1,9 +1,39 @@ |
390 | libframe.so.6 libframe6 #MINVER# |
391 | FRAME_2.2@FRAME_2.2 2.2.0 |
392 | + FRAME_2.4@FRAME_2.4 2.4.3 |
393 | frame_axis_get_maximum@FRAME_2.2 2.2.4 |
394 | frame_axis_get_minimum@FRAME_2.2 2.2.4 |
395 | frame_axis_get_resolution@FRAME_2.2 2.2.4 |
396 | frame_axis_get_type@FRAME_2.2 2.2.4 |
397 | + frame_backend_device_add_axis@FRAME_2.4 2.4.3 |
398 | + frame_backend_device_delete@FRAME_2.4 2.4.3 |
399 | + frame_backend_device_get_device@FRAME_2.4 2.4.3 |
400 | + frame_backend_device_new@FRAME_2.4 2.4.3 |
401 | + frame_backend_device_set_direct@FRAME_2.4 2.4.3 |
402 | + frame_backend_device_set_independent@FRAME_2.4 2.4.3 |
403 | + frame_backend_device_set_max_touches@FRAME_2.4 2.4.3 |
404 | + frame_backend_device_set_name@FRAME_2.4 2.4.3 |
405 | + frame_backend_device_set_semi_mt@FRAME_2.4 2.4.3 |
406 | + frame_backend_device_set_window_resolution@FRAME_2.4 2.4.3 |
407 | + frame_backend_frame_borrow_touch_by_id@FRAME_2.4 2.4.3 |
408 | + frame_backend_frame_create_next@FRAME_2.4 2.4.3 |
409 | + frame_backend_frame_delete@FRAME_2.4 2.4.3 |
410 | + frame_backend_frame_get_frame@FRAME_2.4 2.4.3 |
411 | + frame_backend_frame_give_touch@FRAME_2.4 2.4.3 |
412 | + frame_backend_frame_new@FRAME_2.4 2.4.3 |
413 | + frame_backend_frame_set_active_touches@FRAME_2.4 2.4.3 |
414 | + frame_backend_frame_set_device@FRAME_2.4 2.4.3 |
415 | + frame_backend_frame_set_window_id@FRAME_2.4 2.4.3 |
416 | + frame_backend_touch_get_touch@FRAME_2.4 2.4.3 |
417 | + frame_backend_touch_new@FRAME_2.4 2.4.3 |
418 | + frame_backend_touch_set_ended@FRAME_2.4 2.4.3 |
419 | + frame_backend_touch_set_id@FRAME_2.4 2.4.3 |
420 | + frame_backend_touch_set_owned@FRAME_2.4 2.4.3 |
421 | + frame_backend_touch_set_pending_end@FRAME_2.4 2.4.3 |
422 | + frame_backend_touch_set_start_time@FRAME_2.4 2.4.3 |
423 | + frame_backend_touch_set_time@FRAME_2.4 2.4.3 |
424 | + frame_backend_touch_set_value@FRAME_2.4 2.4.3 |
425 | + frame_backend_touch_set_window_pos@FRAME_2.4 2.4.3 |
426 | frame_device_get_axis_by_index@FRAME_2.2 2.2.4 |
427 | frame_device_get_axis_by_type@FRAME_2.2 2.2.4 |
428 | frame_device_get_num_axes@FRAME_2.2 2.2.4 |
429 | @@ -20,7 +50,12 @@ |
430 | frame_event_get_property_uint64_@FRAME_2.2 2.2.4 |
431 | frame_event_get_time@FRAME_2.2 2.2.4 |
432 | frame_event_get_type@FRAME_2.2 2.2.4 |
433 | + frame_event_new@FRAME_2.4 2.4.3 |
434 | frame_event_ref@FRAME_2.2 2.2.4 |
435 | + frame_event_set_device@FRAME_2.4 2.4.3 |
436 | + frame_event_set_frame@FRAME_2.4 2.4.3 |
437 | + frame_event_set_time@FRAME_2.4 2.4.3 |
438 | + frame_event_set_type@FRAME_2.4 2.4.3 |
439 | frame_event_unref@FRAME_2.2 2.2.4 |
440 | frame_frame_get_device@FRAME_2.2 2.2.4 |
441 | frame_frame_get_num_touches@FRAME_2.2 2.2.4 |
442 | |
443 | === modified file 'doc/Makefile.in' |
444 | --- doc/Makefile.in 2012-07-26 18:35:10 +0000 |
445 | +++ doc/Makefile.in 2012-11-08 16:29:22 +0000 |
446 | @@ -1,4 +1,4 @@ |
447 | -# Makefile.in generated by automake 1.11.5 from Makefile.am. |
448 | +# Makefile.in generated by automake 1.11.6 from Makefile.am. |
449 | # @configure_input@ |
450 | |
451 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, |
452 | |
453 | === modified file 'include/oif/frame.h' |
454 | --- include/oif/frame.h 2012-07-24 21:36:05 +0000 |
455 | +++ include/oif/frame.h 2012-11-08 16:29:22 +0000 |
456 | @@ -89,6 +89,7 @@ |
457 | UFStatusErrorInvalidType, /**< The variable type passed as a void pointer into |
458 | a property getter is invalid for the property |
459 | */ |
460 | + UFStatusErrorTouchIdExists, /**< A touch with the same ID already exists */ |
461 | } UFStatus; |
462 | |
463 | /** Properties of a device */ |
464 | |
465 | === added file 'include/oif/frame_backend.h' |
466 | --- include/oif/frame_backend.h 1970-01-01 00:00:00 +0000 |
467 | +++ include/oif/frame_backend.h 2012-11-08 16:29:22 +0000 |
468 | @@ -0,0 +1,291 @@ |
469 | +/** |
470 | + * @file oif/frame_backend.h |
471 | + * API for creating objects. |
472 | + */ |
473 | + |
474 | +#ifndef FRAME_OIF_FRAME_BACKEND_H_ |
475 | +#define FRAME_OIF_FRAME_BACKEND_H_ |
476 | + |
477 | +/* front end definitions */ |
478 | +#include <oif/frame.h> |
479 | + |
480 | +#ifdef __cplusplus |
481 | +extern "C" { |
482 | +#endif |
483 | + |
484 | +/** Handle for a device to be used on the backend API */ |
485 | +typedef struct UFBackendDevice_* UFBackendDevice; |
486 | + |
487 | +/** Handle for a frame to be used on the backend API */ |
488 | +typedef struct UFBackendFrame_* UFBackendFrame; |
489 | + |
490 | +/** Handle for a touch to be used on the backend API */ |
491 | +typedef struct UFBackendTouch_* UFBackendTouch; |
492 | + |
493 | +/******************************************************************** |
494 | + * Event |
495 | + ********************************************************************/ |
496 | + |
497 | +/** |
498 | + * Creates a new event with a reference count of one. |
499 | + */ |
500 | +FRAME_PUBLIC |
501 | +UFEvent frame_event_new(); |
502 | + |
503 | +/** |
504 | + * Sets the type of the given event |
505 | + */ |
506 | +FRAME_PUBLIC |
507 | +void frame_event_set_type(UFEvent event, UFEventType type); |
508 | + |
509 | +/** |
510 | + * Sets the device property of the given event |
511 | + * |
512 | + * It increases the reference count of the corresponding UFDevice by one. |
513 | + */ |
514 | +FRAME_PUBLIC |
515 | +void frame_event_set_device(UFEvent event, UFBackendDevice device); |
516 | + |
517 | +/** |
518 | + * Sets the frame property of the given event |
519 | + * |
520 | + * It increases the reference count of the corresponding UFFrame by one. |
521 | + */ |
522 | +FRAME_PUBLIC |
523 | +void frame_event_set_frame(UFEvent event, UFBackendFrame frame); |
524 | + |
525 | +/** |
526 | + * Sets the time of the given event |
527 | + */ |
528 | +FRAME_PUBLIC |
529 | +void frame_event_set_time(UFEvent event, uint64_t time); |
530 | + |
531 | +/******************************************************************** |
532 | + * Device |
533 | + ********************************************************************/ |
534 | + |
535 | +/** |
536 | + * Creates a new UFDevice and returns its backend handle. |
537 | + */ |
538 | +FRAME_PUBLIC |
539 | +UFBackendDevice frame_backend_device_new(); |
540 | + |
541 | +/** |
542 | + * Returns a UFDevice instance given its backend handle. |
543 | + */ |
544 | +FRAME_PUBLIC |
545 | +UFDevice frame_backend_device_get_device(UFBackendDevice device); |
546 | + |
547 | +/** |
548 | + * Sets the "Name" property of the given device |
549 | + */ |
550 | +FRAME_PUBLIC |
551 | +void frame_backend_device_set_name(UFBackendDevice device, const char *name); |
552 | + |
553 | +/** |
554 | + * Sets the "Direct" property of the given device |
555 | + */ |
556 | +FRAME_PUBLIC |
557 | +void frame_backend_device_set_direct(UFBackendDevice device, int direct); |
558 | + |
559 | +/** |
560 | + * Sets the "Independent" property of the given device |
561 | + */ |
562 | +FRAME_PUBLIC |
563 | +void frame_backend_device_set_independent(UFBackendDevice device, int independent); |
564 | + |
565 | +/** |
566 | + * Sets the "SemiMT" property of the given device |
567 | + */ |
568 | +FRAME_PUBLIC |
569 | +void frame_backend_device_set_semi_mt(UFBackendDevice device, int semi_mt); |
570 | + |
571 | +/** |
572 | + * Sets the "MaxTouches" property of the given device |
573 | + */ |
574 | +FRAME_PUBLIC |
575 | +void frame_backend_device_set_max_touches(UFBackendDevice device, unsigned int max_touches); |
576 | + |
577 | +/** |
578 | + * Sets the "WindowResolutionX" and "WindowResolutionY" properties of the |
579 | + * given device. |
580 | + */ |
581 | +FRAME_PUBLIC |
582 | +void frame_backend_device_set_window_resolution(UFBackendDevice device, float x, float y); |
583 | + |
584 | +/** |
585 | + * Adds an axis to the device |
586 | + */ |
587 | +FRAME_PUBLIC |
588 | +void frame_backend_device_add_axis(UFBackendDevice device, |
589 | + UFAxisType type, |
590 | + float min, float max, float resolution); |
591 | + |
592 | +/** |
593 | + * Deletes the backend handle of a UFDevice, decreasing its reference count by one. |
594 | + */ |
595 | +FRAME_PUBLIC |
596 | +void frame_backend_device_delete(UFBackendDevice device); |
597 | + |
598 | +/******************************************************************** |
599 | + * Frame |
600 | + ********************************************************************/ |
601 | + |
602 | +/** |
603 | + * Creates a new, empty, UFFrame and returns its backend handle. |
604 | + * |
605 | + * Usually you will use this method only for the very first frame. For all |
606 | + * subsequent ones it will be safer and more convinent to use |
607 | + * frame_backend_frame_create_next(). |
608 | + */ |
609 | +FRAME_PUBLIC |
610 | +UFBackendFrame frame_backend_frame_new(); |
611 | + |
612 | +/** |
613 | + * Creates a new UFFrame that is a continuation of the given one. |
614 | + * |
615 | + * Touches that had a "begin" state on the given frame will be hard-copied and |
616 | + * have an "update" state on the new frame. |
617 | + * |
618 | + * Touches that had an "update" state will be lazily copied to the new frame. |
619 | + * |
620 | + * Touches that had a "end" state on the given frame won't be present |
621 | + * on the new frame. |
622 | + */ |
623 | +FRAME_PUBLIC |
624 | +UFBackendFrame frame_backend_frame_create_next(UFBackendFrame frame); |
625 | + |
626 | +/** |
627 | + * Returns a UFFrame instance given its backend handle. |
628 | + */ |
629 | +FRAME_PUBLIC |
630 | +UFFrame frame_backend_frame_get_frame(UFBackendFrame frame); |
631 | + |
632 | +/** |
633 | + * Gets a UFBackendTouch for the UFTouch that has the given id. |
634 | + * |
635 | + * The underlying UFTouch is moved from the given frame to the returned UFBackendTouch. |
636 | + * Once done modifying the touch you're expected to return it to the frame via |
637 | + * frame_backend_frame_give_touch(). |
638 | + * |
639 | + * If the underlying UFTouch is a lazy copy (likely from a touch in the previous frame), a hard copy |
640 | + * will be made upon the first change made to it. |
641 | + * |
642 | + * Possible errors: UFStatusErrorInvalidTouch |
643 | + */ |
644 | +FRAME_PUBLIC |
645 | +UFStatus frame_backend_frame_borrow_touch_by_id(UFBackendFrame frame, |
646 | + UFTouchId id, |
647 | + UFBackendTouch *touch); |
648 | + |
649 | +/** |
650 | + * Sets the "Device" property of the given frame |
651 | + */ |
652 | +FRAME_PUBLIC |
653 | +void frame_backend_frame_set_device(UFBackendFrame frame, UFBackendDevice device); |
654 | + |
655 | +/** |
656 | + * Sets the "WindowId" property of the given frame |
657 | + */ |
658 | +FRAME_PUBLIC |
659 | +void frame_backend_frame_set_window_id(UFBackendFrame frame, UFWindowId window_id); |
660 | + |
661 | +/** |
662 | + * Sets the "ActiveTouches" property of the given frame |
663 | + * |
664 | + * If unset this property returns the number of touches. |
665 | + */ |
666 | +FRAME_PUBLIC |
667 | +void frame_backend_frame_set_active_touches(UFBackendFrame frame, unsigned int active_touches); |
668 | + |
669 | +/** |
670 | + * Gives a UFTouch to the specified frame. |
671 | + * |
672 | + * Gives the underlying UFTouch to the specified frame. The UFBackendTouch |
673 | + * is deleted and no longer valid after this call. |
674 | + * |
675 | + * Possible errors: UFStatusErrorTouchIdExists |
676 | + */ |
677 | +FRAME_PUBLIC |
678 | +UFStatus frame_backend_frame_give_touch(UFBackendFrame frame, UFBackendTouch *touch); |
679 | + |
680 | +/** |
681 | + * Deletes the backend handle of a UFFrame, |
682 | + * decreasing its reference count by one. |
683 | + */ |
684 | +FRAME_PUBLIC |
685 | +void frame_backend_frame_delete(UFBackendFrame frame); |
686 | + |
687 | +/******************************************************************** |
688 | + * Touch |
689 | + ********************************************************************/ |
690 | + |
691 | +/** |
692 | + * Creates a new UFTouch and returns its backend handle. |
693 | + * |
694 | + * Its state will be set to "Begin". |
695 | + * |
696 | + * After filled out, it should be given to a frame via frame_backend_frame_give_touch() |
697 | + */ |
698 | +FRAME_PUBLIC |
699 | +UFBackendTouch frame_backend_touch_new(); |
700 | + |
701 | +/** |
702 | + * Returns a UFTouch instance given its backend handle. |
703 | + */ |
704 | +FRAME_PUBLIC |
705 | +UFTouch frame_backend_touch_get_touch(UFBackendTouch touch); |
706 | + |
707 | +/** |
708 | + * Sets the "Id" property of the given touch |
709 | + */ |
710 | +FRAME_PUBLIC |
711 | +void frame_backend_touch_set_id(UFBackendTouch touch, UFTouchId id); |
712 | + |
713 | +/** |
714 | + * Sets the "State" property of the given touch to "End" |
715 | + */ |
716 | +FRAME_PUBLIC |
717 | +void frame_backend_touch_set_ended(UFBackendTouch touch); |
718 | + |
719 | +/** |
720 | + * Sets the "WindowX" and "WindowY" properties of the given touch |
721 | + */ |
722 | +FRAME_PUBLIC |
723 | +void frame_backend_touch_set_window_pos(UFBackendTouch touch, float x, float y); |
724 | + |
725 | +/** |
726 | + * Sets the "Time" property of the given touch |
727 | + */ |
728 | +FRAME_PUBLIC |
729 | +void frame_backend_touch_set_time(UFBackendTouch touch, uint64_t time); |
730 | + |
731 | +/** |
732 | + * Sets the "StartTime" property of the given touch |
733 | + */ |
734 | +FRAME_PUBLIC |
735 | +void frame_backend_touch_set_start_time(UFBackendTouch touch, uint64_t start_time); |
736 | + |
737 | +/** |
738 | + * Sets the "Owned" property of the given touch |
739 | + */ |
740 | +FRAME_PUBLIC |
741 | +void frame_backend_touch_set_owned(UFBackendTouch touch, int owned); |
742 | + |
743 | +/** |
744 | + * Sets the "PendingEnd" property of the given touch |
745 | + */ |
746 | +FRAME_PUBLIC |
747 | +void frame_backend_touch_set_pending_end(UFBackendTouch touch, int pending_end); |
748 | + |
749 | +/** |
750 | + * Sets the value of an axis of the given touch |
751 | + */ |
752 | +FRAME_PUBLIC |
753 | +void frame_backend_touch_set_value(UFBackendTouch touch, UFAxisType type, float value); |
754 | + |
755 | +#ifdef __cplusplus |
756 | +} |
757 | +#endif |
758 | + |
759 | +#endif /* FRAME_OIF_FRAME_BACKEND_H_ */ |
760 | |
761 | === modified file 'src/Makefile.am' |
762 | --- src/Makefile.am 2012-06-21 19:41:40 +0000 |
763 | +++ src/Makefile.am 2012-11-08 16:29:22 +0000 |
764 | @@ -9,8 +9,6 @@ |
765 | |
766 | libframe_la_LIBADD = \ |
767 | -lm \ |
768 | - $(EVEMU_LIBS) \ |
769 | - $(MTDEV_LIBS) \ |
770 | $(COVERAGE_LIBS) \ |
771 | $(XINPUT_LIBS) \ |
772 | $(CXX_LIBS) |
773 | @@ -32,6 +30,7 @@ |
774 | libframeincludedir = $(includedir)/oif |
775 | libframeinclude_HEADERS = \ |
776 | $(top_srcdir)/include/oif/frame.h \ |
777 | + $(top_srcdir)/include/oif/frame_backend.h \ |
778 | $(top_srcdir)/include/oif/frame_internal.h \ |
779 | $(top_srcdir)/include/oif/frame_x11.h |
780 | |
781 | |
782 | === modified file 'src/Makefile.in' |
783 | --- src/Makefile.in 2012-07-26 18:35:10 +0000 |
784 | +++ src/Makefile.in 2012-11-08 16:29:22 +0000 |
785 | @@ -1,4 +1,4 @@ |
786 | -# Makefile.in generated by automake 1.11.5 from Makefile.am. |
787 | +# Makefile.in generated by automake 1.11.6 from Makefile.am. |
788 | # @configure_input@ |
789 | |
790 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, |
791 | @@ -100,7 +100,7 @@ |
792 | LTLIBRARIES = $(lib_LTLIBRARIES) |
793 | am__DEPENDENCIES_1 = |
794 | libframe_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ |
795 | - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) |
796 | + $(am__DEPENDENCIES_1) |
797 | am_libframe_la_OBJECTS = axis.lo device.lo event.lo frame.lo handle.lo \ |
798 | touch.lo value.lo window.lo device_x11.lo frame_x11.lo \ |
799 | handle_x11.lo window_x11.lo |
800 | @@ -340,8 +340,6 @@ |
801 | |
802 | libframe_la_LIBADD = \ |
803 | -lm \ |
804 | - $(EVEMU_LIBS) \ |
805 | - $(MTDEV_LIBS) \ |
806 | $(COVERAGE_LIBS) \ |
807 | $(XINPUT_LIBS) \ |
808 | $(CXX_LIBS) |
809 | @@ -362,6 +360,7 @@ |
810 | libframeincludedir = $(includedir)/oif |
811 | libframeinclude_HEADERS = \ |
812 | $(top_srcdir)/include/oif/frame.h \ |
813 | + $(top_srcdir)/include/oif/frame_backend.h \ |
814 | $(top_srcdir)/include/oif/frame_internal.h \ |
815 | $(top_srcdir)/include/oif/frame_x11.h |
816 | |
817 | |
818 | === modified file 'src/device.cpp' |
819 | --- src/device.cpp 2012-06-21 19:41:40 +0000 |
820 | +++ src/device.cpp 2012-11-08 16:29:22 +0000 |
821 | @@ -24,6 +24,8 @@ |
822 | |
823 | #include "axis.h" |
824 | |
825 | +#include <oif/frame_backend.h> |
826 | + |
827 | namespace oif { |
828 | namespace frame { |
829 | |
830 | @@ -75,18 +77,30 @@ |
831 | UFStatus frame_device_get_property_unsigned_int_(UFDevice device, |
832 | UFDeviceProperty property, |
833 | unsigned int *value) { |
834 | - return static_cast<const oif::frame::UFDevice*>(device)->GetProperty( |
835 | - property, |
836 | - value); |
837 | + |
838 | + if (property == UFDevicePropertyNumAxes) { |
839 | + *value = static_cast<const oif::frame::UFDevice*>(device)->axes_.size(); |
840 | + return UFStatusSuccess; |
841 | + } else { |
842 | + return static_cast<const oif::frame::UFDevice*>(device)->GetProperty( |
843 | + property, |
844 | + value); |
845 | + } |
846 | } |
847 | |
848 | #undef frame_device_get_property /* Override C11 generic selections macro */ |
849 | FRAME_PUBLIC |
850 | UFStatus frame_device_get_property(UFDevice device, UFDeviceProperty property, |
851 | void *value) { |
852 | - return static_cast<const oif::frame::UFDevice*>(device)->GetProperty( |
853 | - property, |
854 | - value); |
855 | + if (property == UFDevicePropertyNumAxes) { |
856 | + *reinterpret_cast<unsigned int *>(value) = |
857 | + static_cast<const oif::frame::UFDevice*>(device)->axes_.size(); |
858 | + return UFStatusSuccess; |
859 | + } else { |
860 | + return static_cast<const oif::frame::UFDevice*>(device)->GetProperty( |
861 | + property, |
862 | + value); |
863 | + } |
864 | } |
865 | |
866 | UFStatus frame_device_get_axis_by_index(UFDevice device, unsigned int index, |
867 | @@ -129,4 +143,77 @@ |
868 | return resolution; |
869 | } |
870 | |
871 | +UFBackendDevice frame_backend_device_new() |
872 | +{ |
873 | + return new UFBackendDevice_(new oif::frame::UFDevice); |
874 | +} |
875 | + |
876 | +UFDevice frame_backend_device_get_device(UFBackendDevice device) |
877 | +{ |
878 | + return device->shared_ptr.get(); |
879 | +} |
880 | + |
881 | +void frame_backend_device_delete(UFBackendDevice device) |
882 | +{ |
883 | + delete device; |
884 | +} |
885 | + |
886 | +void frame_backend_device_set_name(UFBackendDevice device, const char *name) |
887 | +{ |
888 | + static_cast<oif::frame::UFDevice*>(device->shared_ptr.get())-> |
889 | + InsertProperty(UFDevicePropertyName, |
890 | + new oif::frame::Value(name)); |
891 | +} |
892 | + |
893 | +void frame_backend_device_set_direct(UFBackendDevice device, int direct) |
894 | +{ |
895 | + static_cast<oif::frame::UFDevice*>(device->shared_ptr.get())-> |
896 | + InsertProperty(UFDevicePropertyDirect, |
897 | + new oif::frame::Value(direct)); |
898 | +} |
899 | + |
900 | +void frame_backend_device_set_independent(UFBackendDevice device, int independent) |
901 | +{ |
902 | + static_cast<oif::frame::UFDevice*>(device->shared_ptr.get())-> |
903 | + InsertProperty(UFDevicePropertyIndependent, |
904 | + new oif::frame::Value(independent)); |
905 | +} |
906 | + |
907 | +void frame_backend_device_set_semi_mt(UFBackendDevice device, int semi_mt) |
908 | +{ |
909 | + static_cast<oif::frame::UFDevice*>(device->shared_ptr.get())-> |
910 | + InsertProperty(UFDevicePropertySemiMT, |
911 | + new oif::frame::Value(semi_mt)); |
912 | +} |
913 | + |
914 | +void frame_backend_device_set_max_touches(UFBackendDevice device, unsigned int max_touches) |
915 | +{ |
916 | + static_cast<oif::frame::UFDevice*>(device->shared_ptr.get())-> |
917 | + InsertProperty(UFDevicePropertyMaxTouches, |
918 | + new oif::frame::Value(max_touches)); |
919 | +} |
920 | + |
921 | +void frame_backend_device_set_window_resolution(UFBackendDevice device, float x, float y) |
922 | +{ |
923 | + static_cast<oif::frame::UFDevice*>(device->shared_ptr.get())-> |
924 | + InsertProperty(UFDevicePropertyWindowResolutionX, |
925 | + new oif::frame::Value(x)); |
926 | + |
927 | + static_cast<oif::frame::UFDevice*>(device->shared_ptr.get())-> |
928 | + InsertProperty(UFDevicePropertyWindowResolutionY, |
929 | + new oif::frame::Value(y)); |
930 | +} |
931 | + |
932 | +void frame_backend_device_add_axis(UFBackendDevice device, |
933 | + UFAxisType type, |
934 | + float min, float max, float resolution) |
935 | +{ |
936 | + using oif::frame::UFAxis; |
937 | + |
938 | + UFAxis_* axis = new UFAxis(type, min, max, resolution); |
939 | + |
940 | + static_cast<oif::frame::UFDevice*>(device->shared_ptr.get())-> |
941 | + axes_[type] = std::unique_ptr<UFAxis>(static_cast<UFAxis*>(axis)); |
942 | +} |
943 | + |
944 | } // extern "C" |
945 | |
946 | === modified file 'src/device.h' |
947 | --- src/device.h 2012-06-21 19:41:40 +0000 |
948 | +++ src/device.h 2012-11-08 16:29:22 +0000 |
949 | @@ -32,6 +32,13 @@ |
950 | virtual ~UFDevice_() {}; |
951 | }; |
952 | |
953 | +struct UFBackendDevice_ { |
954 | + UFBackendDevice_(oif::frame::UFDevice* device) |
955 | + : shared_ptr(device) {} |
956 | + |
957 | + oif::frame::SharedUFDevice shared_ptr; |
958 | +}; |
959 | + |
960 | namespace oif { |
961 | namespace frame { |
962 | |
963 | @@ -45,7 +52,6 @@ |
964 | UFDevice(const UFDevice&) = delete; |
965 | UFDevice& operator=(const UFDevice&) = delete; |
966 | |
967 | - protected: |
968 | typedef std::unique_ptr<UFAxis> UniqueUFAxis; |
969 | |
970 | std::map<UFAxisType, UniqueUFAxis> axes_; |
971 | |
972 | === modified file 'src/event.cpp' |
973 | --- src/event.cpp 2012-06-21 19:41:40 +0000 |
974 | +++ src/event.cpp 2012-11-08 16:29:22 +0000 |
975 | @@ -22,10 +22,17 @@ |
976 | |
977 | #include "event.h" |
978 | #include "frame.h" |
979 | +#include "device.h" |
980 | + |
981 | +#include <oif/frame_backend.h> |
982 | |
983 | namespace oif { |
984 | namespace frame { |
985 | |
986 | +UFEvent::UFEvent() |
987 | + : ref_count_(1) { |
988 | +} |
989 | + |
990 | UFEvent::UFEvent(UFEventType type, const Value* data, uint64_t time) |
991 | : ref_count_(1) { |
992 | const Value* value; |
993 | @@ -70,6 +77,10 @@ |
994 | |
995 | extern "C" { |
996 | |
997 | +UFEvent frame_event_new() { |
998 | + return new oif::frame::UFEvent; |
999 | +} |
1000 | + |
1001 | void frame_event_ref(UFEvent event) { |
1002 | static_cast<oif::frame::UFEvent*>(event)->Ref(); |
1003 | } |
1004 | @@ -140,4 +151,30 @@ |
1005 | return time; |
1006 | } |
1007 | |
1008 | +void frame_event_set_type(UFEvent event, UFEventType type) |
1009 | +{ |
1010 | + static_cast<oif::frame::UFEvent*>(event)-> |
1011 | + InsertProperty(UFEventPropertyType, new oif::frame::Value(type)); |
1012 | +} |
1013 | + |
1014 | +void frame_event_set_device(UFEvent event, UFBackendDevice device) |
1015 | +{ |
1016 | + static_cast<oif::frame::UFEvent*>(event)-> |
1017 | + InsertProperty(UFEventPropertyDevice, |
1018 | + new oif::frame::Value(device->shared_ptr)); |
1019 | +} |
1020 | + |
1021 | +void frame_event_set_frame(UFEvent event, UFBackendFrame frame) |
1022 | +{ |
1023 | + static_cast<oif::frame::UFEvent*>(event)-> |
1024 | + InsertProperty(UFEventPropertyFrame, |
1025 | + new oif::frame::Value(frame->shared_ptr)); |
1026 | +} |
1027 | + |
1028 | +void frame_event_set_time(UFEvent event, uint64_t time) |
1029 | +{ |
1030 | + static_cast<oif::frame::UFEvent*>(event)-> |
1031 | + InsertProperty(UFEventPropertyTime, new oif::frame::Value(time)); |
1032 | +} |
1033 | + |
1034 | } // extern "C" |
1035 | |
1036 | === modified file 'src/event.h' |
1037 | --- src/event.h 2012-06-21 19:41:40 +0000 |
1038 | +++ src/event.h 2012-11-08 16:29:22 +0000 |
1039 | @@ -37,6 +37,7 @@ |
1040 | |
1041 | class UFEvent : public UFEvent_, public Property<UFEventProperty> { |
1042 | public: |
1043 | + UFEvent(); |
1044 | UFEvent(UFEventType type, const Value* data, uint64_t time); |
1045 | ~UFEvent(); |
1046 | |
1047 | |
1048 | === modified file 'src/frame.cpp' |
1049 | --- src/frame.cpp 2012-06-21 19:41:40 +0000 |
1050 | +++ src/frame.cpp 2012-11-08 16:29:22 +0000 |
1051 | @@ -23,15 +23,16 @@ |
1052 | #include <assert.h> |
1053 | #include <stdio.h> |
1054 | |
1055 | +#include "device.h" |
1056 | #include "touch.h" |
1057 | -#include "window.h" |
1058 | + |
1059 | +#include <oif/frame_backend.h> |
1060 | |
1061 | namespace oif { |
1062 | namespace frame { |
1063 | |
1064 | -UFFrame::UFFrame(const SharedWindow& window, const SharedUFFrame& prev) |
1065 | +UFFrame::UFFrame(const SharedUFFrame& prev) |
1066 | : prev_(prev), |
1067 | - window_(window), |
1068 | touches_array_(), |
1069 | touches_map_() { |
1070 | for (const SharedUFTouch& prev_touch : prev_->touches_array_) { |
1071 | @@ -93,6 +94,30 @@ |
1072 | |
1073 | } // namespace |
1074 | |
1075 | +UFStatus UFFrame::GiveTouch(SharedUFTouch& touch) { |
1076 | + auto map_it = touches_map_.find(touch->id()); |
1077 | + if (map_it != touches_map_.end()) { |
1078 | + /* A loan is being returned */ |
1079 | + |
1080 | + SharedUFTouch &our_touch = touches_array_[map_it->second]; |
1081 | + |
1082 | + /* we shouldn't be referencing to any UFTouch here. |
1083 | + If we are, it's a programming error by the API user. */ |
1084 | + if (our_touch.get() != NULL) { |
1085 | + return UFStatusErrorTouchIdExists; |
1086 | + } |
1087 | + |
1088 | + /* take back our UFtouch */ |
1089 | + our_touch.swap(touch); |
1090 | + } else { |
1091 | + touches_map_[touch->id()] = touches_array_.size(); |
1092 | + touches_array_.push_back(touch); |
1093 | + touch.reset(); |
1094 | + } |
1095 | + |
1096 | + return UFStatusSuccess; |
1097 | +} |
1098 | + |
1099 | void UFFrame::UpdateTouch(const SharedUFTouch& touch) { |
1100 | auto map_it = touches_map_.find(touch->id()); |
1101 | |
1102 | @@ -104,12 +129,6 @@ |
1103 | } else { |
1104 | touches_map_[touch->id()] = touches_array_.size(); |
1105 | touches_array_.push_back(touch); |
1106 | - |
1107 | - const Value *value; |
1108 | - value = new Value(static_cast<unsigned int>(touches_map_.size())); |
1109 | - InsertProperty(UFFramePropertyNumTouches, value); |
1110 | - value = new Value(static_cast<unsigned int>(touches_map_.size())); |
1111 | - InsertProperty(UFFramePropertyActiveTouches, value); |
1112 | } |
1113 | break; |
1114 | |
1115 | @@ -169,6 +188,14 @@ |
1116 | return UFStatusSuccess; |
1117 | } |
1118 | |
1119 | +SharedUFTouch* UFFrame::GetSharedTouchById(UFTouchId touch_id) { |
1120 | + auto it = touches_map_.find(touch_id); |
1121 | + if (it == touches_map_.end()) |
1122 | + return nullptr; |
1123 | + else |
1124 | + return &(touches_array_[it->second]); |
1125 | +} |
1126 | + |
1127 | UFStatus UFFrame::GetTouchById(UFTouchId touch_id, ::UFTouch* touch) const { |
1128 | auto it = touches_map_.find(touch_id); |
1129 | if (it == touches_map_.end()) |
1130 | @@ -211,8 +238,21 @@ |
1131 | UFFrameProperty property, |
1132 | unsigned int *value) { |
1133 | const oif::frame::UFFrame* ufframe = |
1134 | - static_cast<const oif::frame::UFFrame*>(frame); |
1135 | - return ufframe->GetProperty(property, value); |
1136 | + static_cast<const oif::frame::UFFrame*>(frame); |
1137 | + |
1138 | + if (property == UFFramePropertyNumTouches) { |
1139 | + *value = ufframe->GetNumTouches(); |
1140 | + return UFStatusSuccess; |
1141 | + } else if (property == UFFramePropertyActiveTouches) { |
1142 | + UFStatus status = ufframe->GetProperty(property, value); |
1143 | + if (status != UFStatusSuccess) { |
1144 | + *value = ufframe->GetNumTouches(); |
1145 | + status = UFStatusSuccess; |
1146 | + } |
1147 | + return status; |
1148 | + } else { |
1149 | + return ufframe->GetProperty(property, value); |
1150 | + } |
1151 | } |
1152 | |
1153 | #undef frame_frame_get_property /* Override C11 generic selections macro */ |
1154 | @@ -221,7 +261,20 @@ |
1155 | void *value) { |
1156 | const oif::frame::UFFrame* ufframe = |
1157 | static_cast<const oif::frame::UFFrame*>(frame); |
1158 | - return ufframe->GetProperty(property, value); |
1159 | + |
1160 | + if (property == UFFramePropertyNumTouches) { |
1161 | + *reinterpret_cast<unsigned int *>(value) = ufframe->GetNumTouches(); |
1162 | + return UFStatusSuccess; |
1163 | + } else if (property == UFFramePropertyActiveTouches) { |
1164 | + UFStatus status = ufframe->GetProperty(property, value); |
1165 | + if (status != UFStatusSuccess) { |
1166 | + *reinterpret_cast<unsigned int *>(value) = ufframe->GetNumTouches(); |
1167 | + status = UFStatusSuccess; |
1168 | + } |
1169 | + return status; |
1170 | + } else { |
1171 | + return ufframe->GetProperty(property, value); |
1172 | + } |
1173 | } |
1174 | |
1175 | UFStatus frame_frame_get_touch_by_index(UFFrame frame, unsigned int index, |
1176 | @@ -269,13 +322,9 @@ |
1177 | } |
1178 | |
1179 | uint32_t frame_frame_get_num_touches(UFFrame frame) { |
1180 | - unsigned int num_touches; |
1181 | const oif::frame::UFFrame* ufframe = |
1182 | static_cast<const oif::frame::UFFrame*>(frame); |
1183 | - UFStatus status = ufframe->GetProperty(UFFramePropertyNumTouches, |
1184 | - &num_touches); |
1185 | - assert(status == UFStatusSuccess); |
1186 | - return num_touches; |
1187 | + return ufframe->GetNumTouches(); |
1188 | } |
1189 | |
1190 | UFDevice frame_frame_get_device(UFFrame frame) { |
1191 | @@ -287,4 +336,80 @@ |
1192 | return device; |
1193 | } |
1194 | |
1195 | +UFBackendFrame frame_backend_frame_new() |
1196 | +{ |
1197 | + return new UFBackendFrame_(new oif::frame::UFFrame); |
1198 | +} |
1199 | + |
1200 | +UFBackendFrame frame_backend_frame_create_next(UFBackendFrame frame) |
1201 | +{ |
1202 | + return new UFBackendFrame_(new oif::frame::UFFrame(frame->shared_ptr)); |
1203 | +} |
1204 | + |
1205 | +UFFrame frame_backend_frame_get_frame(UFBackendFrame frame) |
1206 | +{ |
1207 | + return frame->shared_ptr.get(); |
1208 | +} |
1209 | + |
1210 | +UFStatus frame_backend_frame_borrow_touch_by_id(UFBackendFrame frame, |
1211 | + UFTouchId id, |
1212 | + UFBackendTouch *touch) |
1213 | +{ |
1214 | + oif::frame::UFFrame* ufframe = |
1215 | + static_cast<oif::frame::UFFrame*>(frame->shared_ptr.get()); |
1216 | + |
1217 | + oif::frame::SharedUFTouch *shared_touch = ufframe->GetSharedTouchById(id); |
1218 | + if (shared_touch) { |
1219 | + *touch = new UFBackendTouch_(*shared_touch); |
1220 | + return UFStatusSuccess; |
1221 | + } else { |
1222 | + return UFStatusErrorInvalidTouch; |
1223 | + } |
1224 | +} |
1225 | + |
1226 | +void frame_backend_frame_set_device(UFBackendFrame frame, UFBackendDevice device) |
1227 | +{ |
1228 | + static_cast<oif::frame::UFFrame*>(frame->shared_ptr.get())-> |
1229 | + InsertProperty(UFFramePropertyDevice, |
1230 | + new oif::frame::Value(device->shared_ptr)); |
1231 | +} |
1232 | + |
1233 | +void frame_backend_frame_set_window_id(UFBackendFrame frame, UFWindowId window_id) |
1234 | +{ |
1235 | + static_cast<oif::frame::UFFrame*>(frame->shared_ptr.get())-> |
1236 | + InsertProperty(UFFramePropertyWindowId, |
1237 | + new oif::frame::Value(window_id)); |
1238 | +} |
1239 | + |
1240 | +void frame_backend_frame_set_active_touches(UFBackendFrame frame, unsigned int active_touches) |
1241 | +{ |
1242 | + static_cast<oif::frame::UFFrame*>(frame->shared_ptr.get())-> |
1243 | + InsertProperty(UFFramePropertyActiveTouches, |
1244 | + new oif::frame::Value(active_touches)); |
1245 | +} |
1246 | + |
1247 | +UFStatus frame_backend_frame_give_touch(UFBackendFrame frame, UFBackendTouch *touch) |
1248 | +{ |
1249 | + UFStatus status; |
1250 | + |
1251 | + /* the touch backend must be carrying a UFtouch */ |
1252 | + assert((*touch)->shared_ptr); |
1253 | + |
1254 | + status = static_cast<oif::frame::UFFrame*>(frame->shared_ptr.get())-> |
1255 | + GiveTouch((*touch)->shared_ptr); |
1256 | + |
1257 | + /* frame must have taken the touch */ |
1258 | + assert(!(*touch)->shared_ptr); |
1259 | + |
1260 | + delete (*touch); |
1261 | + *touch = nullptr; |
1262 | + |
1263 | + return status; |
1264 | +} |
1265 | + |
1266 | +void frame_backend_frame_delete(UFBackendFrame frame) |
1267 | +{ |
1268 | + delete frame; |
1269 | +} |
1270 | + |
1271 | } // extern "C" |
1272 | |
1273 | === modified file 'src/frame.h' |
1274 | --- src/frame.h 2012-06-21 19:41:40 +0000 |
1275 | +++ src/frame.h 2012-11-08 16:29:22 +0000 |
1276 | @@ -33,23 +33,33 @@ |
1277 | virtual ~UFFrame_() {} |
1278 | }; |
1279 | |
1280 | +struct UFBackendFrame_ { |
1281 | + UFBackendFrame_(oif::frame::UFFrame* frame) |
1282 | + : shared_ptr(frame) {} |
1283 | + |
1284 | + oif::frame::SharedUFFrame shared_ptr; |
1285 | +}; |
1286 | + |
1287 | namespace oif { |
1288 | namespace frame { |
1289 | |
1290 | class UFFrame : public UFFrame_, public Property<UFFrameProperty> { |
1291 | public: |
1292 | - UFFrame() : prev_(), window_(), touches_array_(), touches_map_() {} |
1293 | - UFFrame(const SharedWindow& window, const SharedUFFrame& prev); |
1294 | + UFFrame() : prev_(), touches_array_(), touches_map_() {} |
1295 | + UFFrame(const SharedUFFrame& prev); |
1296 | |
1297 | UFTouch* CopyTouch(UFTouchId touchid, UFTouchState new_state) const; |
1298 | bool IsTouchOwned(UFTouchId touchid); |
1299 | + UFStatus GiveTouch(SharedUFTouch& touch); |
1300 | void UpdateTouch(const SharedUFTouch& touch); |
1301 | bool IsEnded() const; |
1302 | + unsigned int GetNumTouches() const { return touches_array_.size(); } |
1303 | UFStatus GetPreviousTouchValue(const UFTouch* touch, UFAxisType type, |
1304 | float* value) const; |
1305 | UFStatus GetPreviousTouchProperty(const UFTouch* touch, |
1306 | UFTouchProperty property, void* value) const; |
1307 | UFStatus GetTouchByIndex(unsigned int index, ::UFTouch* touch) const; |
1308 | + SharedUFTouch* GetSharedTouchById(UFTouchId touch_id); |
1309 | UFStatus GetTouchById(UFTouchId touch_id, ::UFTouch* touch) const; |
1310 | void ReleasePreviousFrame(); |
1311 | |
1312 | @@ -58,7 +68,6 @@ |
1313 | |
1314 | private: |
1315 | SharedUFFrame prev_; |
1316 | - SharedWindow window_; |
1317 | std::vector<SharedUFTouch> touches_array_; |
1318 | std::map<UFTouchId, unsigned int> touches_map_; |
1319 | }; |
1320 | |
1321 | === modified file 'src/libframe.ver' |
1322 | --- src/libframe.ver 2012-06-21 19:41:40 +0000 |
1323 | +++ src/libframe.ver 2012-11-08 16:29:22 +0000 |
1324 | @@ -64,3 +64,42 @@ |
1325 | local: |
1326 | *; |
1327 | }; |
1328 | + |
1329 | +FRAME_2.4 { |
1330 | + global: |
1331 | + frame_backend_device_new; |
1332 | + frame_backend_device_get_device; |
1333 | + frame_backend_device_delete; |
1334 | + frame_backend_device_set_name; |
1335 | + frame_backend_device_set_direct; |
1336 | + frame_backend_device_set_independent; |
1337 | + frame_backend_device_set_semi_mt; |
1338 | + frame_backend_device_set_max_touches; |
1339 | + frame_backend_device_set_window_resolution; |
1340 | + frame_backend_device_add_axis; |
1341 | + frame_backend_frame_new; |
1342 | + frame_backend_frame_create_next; |
1343 | + frame_backend_frame_get_frame; |
1344 | + frame_backend_frame_borrow_touch_by_id; |
1345 | + frame_backend_frame_set_device; |
1346 | + frame_backend_frame_set_window_id; |
1347 | + frame_backend_frame_set_active_touches; |
1348 | + frame_backend_frame_give_touch; |
1349 | + frame_backend_frame_delete; |
1350 | + frame_backend_touch_new; |
1351 | + frame_backend_touch_get_touch; |
1352 | + frame_backend_touch_set_id; |
1353 | + frame_backend_touch_set_ended; |
1354 | + frame_backend_touch_set_window_pos; |
1355 | + frame_backend_touch_set_time; |
1356 | + frame_backend_touch_set_start_time; |
1357 | + frame_backend_touch_set_owned; |
1358 | + frame_backend_touch_set_pending_end; |
1359 | + frame_backend_touch_set_value; |
1360 | + |
1361 | + frame_event_new; |
1362 | + frame_event_set_type; |
1363 | + frame_event_set_device; |
1364 | + frame_event_set_frame; |
1365 | + frame_event_set_time; |
1366 | +} FRAME_2.2; |
1367 | |
1368 | === modified file 'src/touch.cpp' |
1369 | --- src/touch.cpp 2012-06-21 19:41:40 +0000 |
1370 | +++ src/touch.cpp 2012-11-08 16:29:22 +0000 |
1371 | @@ -24,9 +24,34 @@ |
1372 | |
1373 | #include "frame.h" |
1374 | |
1375 | +#include <oif/frame_backend.h> |
1376 | + |
1377 | +oif::frame::UFTouch* UFBackendTouch_::GetModifiableTouch() { |
1378 | + if (shared_ptr.unique()) { |
1379 | + return static_cast<oif::frame::UFTouch*>(shared_ptr.get()); |
1380 | + } else { |
1381 | + /* Make a hard-copy. We don't want other holders of that UFTouch (like frames |
1382 | + from previous but still existing events) to get the changes about to be |
1383 | + made through this UFBackendTouch. */ |
1384 | + oif::frame::UFTouch *old_touch = |
1385 | + static_cast<oif::frame::UFTouch*>(shared_ptr.get()); |
1386 | + oif::frame::UFTouch *new_touch = new oif::frame::UFTouch(*old_touch); |
1387 | + shared_ptr.reset(new_touch); |
1388 | + return new_touch; |
1389 | + } |
1390 | +} |
1391 | + |
1392 | namespace oif { |
1393 | namespace frame { |
1394 | |
1395 | +UFTouch::UFTouch() |
1396 | + : state_(UFTouchStateBegin) { |
1397 | + const Value* value; |
1398 | + |
1399 | + value = new Value(state_); |
1400 | + InsertProperty(UFTouchPropertyState, value); |
1401 | +} |
1402 | + |
1403 | UFTouch::UFTouch(UFTouchState state, UFTouchId id, float x, float y, |
1404 | uint64_t time) |
1405 | : id_(id), |
1406 | @@ -205,4 +230,75 @@ |
1407 | return start_time; |
1408 | } |
1409 | |
1410 | +UFBackendTouch frame_backend_touch_new() |
1411 | +{ |
1412 | + return new UFBackendTouch_(new oif::frame::UFTouch); |
1413 | +} |
1414 | + |
1415 | +UFTouch frame_backend_touch_get_touch(UFBackendTouch touch) |
1416 | +{ |
1417 | + return touch->shared_ptr.get(); |
1418 | +} |
1419 | + |
1420 | +void frame_backend_touch_set_id(UFBackendTouch touch_backend, UFTouchId id) |
1421 | +{ |
1422 | + oif::frame::UFTouch *touch = touch_backend->GetModifiableTouch(); |
1423 | + |
1424 | + touch->InsertProperty(UFTouchPropertyId, new oif::frame::Value(id)); |
1425 | + touch->SetId(id); |
1426 | +} |
1427 | + |
1428 | +void frame_backend_touch_set_ended(UFBackendTouch touch_backend) |
1429 | +{ |
1430 | + oif::frame::UFTouch *touch = touch_backend->GetModifiableTouch(); |
1431 | + |
1432 | + touch->InsertProperty(UFTouchPropertyState, new oif::frame::Value(UFTouchStateEnd)); |
1433 | + touch->SetState(UFTouchStateEnd); |
1434 | +} |
1435 | + |
1436 | +void frame_backend_touch_set_window_pos(UFBackendTouch touch_backend, float x, float y) |
1437 | +{ |
1438 | + oif::frame::UFTouch *touch = touch_backend->GetModifiableTouch(); |
1439 | + |
1440 | + touch->InsertProperty(UFTouchPropertyWindowX, new oif::frame::Value(x)); |
1441 | + touch->InsertProperty(UFTouchPropertyWindowY, new oif::frame::Value(y)); |
1442 | +} |
1443 | + |
1444 | +void frame_backend_touch_set_time(UFBackendTouch touch_backend, uint64_t time) |
1445 | +{ |
1446 | + oif::frame::UFTouch *touch = touch_backend->GetModifiableTouch(); |
1447 | + |
1448 | + touch->InsertProperty(UFTouchPropertyTime, new oif::frame::Value(time)); |
1449 | +} |
1450 | + |
1451 | +void frame_backend_touch_set_start_time(UFBackendTouch touch_backend, |
1452 | + uint64_t start_time) |
1453 | +{ |
1454 | + oif::frame::UFTouch *touch = touch_backend->GetModifiableTouch(); |
1455 | + |
1456 | + touch->InsertProperty(UFTouchPropertyStartTime, new oif::frame::Value(start_time)); |
1457 | +} |
1458 | + |
1459 | +void frame_backend_touch_set_owned(UFBackendTouch touch_backend, int owned) |
1460 | +{ |
1461 | + oif::frame::UFTouch *touch = touch_backend->GetModifiableTouch(); |
1462 | + |
1463 | + touch->InsertProperty(UFTouchPropertyOwned, new oif::frame::Value(owned)); |
1464 | +} |
1465 | + |
1466 | +void frame_backend_touch_set_pending_end(UFBackendTouch touch_backend, int pending_end) |
1467 | +{ |
1468 | + oif::frame::UFTouch *touch = touch_backend->GetModifiableTouch(); |
1469 | + |
1470 | + touch->InsertProperty(UFTouchPropertyPendingEnd, new oif::frame::Value(pending_end)); |
1471 | +} |
1472 | + |
1473 | +void frame_backend_touch_set_value(UFBackendTouch touch_backend, |
1474 | + UFAxisType type, float value) |
1475 | +{ |
1476 | + oif::frame::UFTouch *touch = touch_backend->GetModifiableTouch(); |
1477 | + |
1478 | + touch->SetValue(type, value); |
1479 | +} |
1480 | + |
1481 | } // extern "C" |
1482 | |
1483 | === modified file 'src/touch.h' |
1484 | --- src/touch.h 2012-06-21 19:41:40 +0000 |
1485 | +++ src/touch.h 2012-11-08 16:29:22 +0000 |
1486 | @@ -34,27 +34,43 @@ |
1487 | virtual ~UFTouch_() {} |
1488 | }; |
1489 | |
1490 | +struct UFBackendTouch_ { |
1491 | + UFBackendTouch_(oif::frame::UFTouch* touch) |
1492 | + : shared_ptr(touch) {} |
1493 | + |
1494 | + UFBackendTouch_(oif::frame::SharedUFTouch &shared_touch) { |
1495 | + shared_ptr.swap(shared_touch); |
1496 | + } |
1497 | + |
1498 | + oif::frame::UFTouch* GetModifiableTouch(); |
1499 | + |
1500 | + oif::frame::SharedUFTouch shared_ptr; |
1501 | +}; |
1502 | + |
1503 | namespace oif { |
1504 | namespace frame { |
1505 | |
1506 | class UFTouch : public UFTouch_, public Property<UFTouchProperty> { |
1507 | public: |
1508 | + UFTouch(); |
1509 | UFTouch(UFTouchState state, UFTouchId id, float x, float y, |
1510 | uint64_t time); |
1511 | UFTouch(const UFTouch& touch, UFTouchState new_state); |
1512 | |
1513 | + void SetId(UFTouchId id) { id_ = id; } |
1514 | UFTouchId id() const { return id_; } |
1515 | + |
1516 | + void SetState(UFTouchState state) { state_ = state; } |
1517 | UFTouchState state() const { return state_; } |
1518 | |
1519 | void SetValue(UFAxisType type, float value); |
1520 | UFStatus GetValue(UFAxisType type, float* value) const; |
1521 | |
1522 | - UFTouch(const UFTouch&) = delete; |
1523 | UFTouch& operator=(const UFTouch&) = delete; |
1524 | |
1525 | private: |
1526 | - const UFTouchId id_; |
1527 | - const UFTouchState state_; |
1528 | + UFTouchId id_; |
1529 | + UFTouchState state_; |
1530 | std::map<UFAxisType, float> values_; |
1531 | }; |
1532 | |
1533 | |
1534 | === modified file 'src/window.h' |
1535 | --- src/window.h 2012-06-21 19:41:40 +0000 |
1536 | +++ src/window.h 2012-11-08 16:29:22 +0000 |
1537 | @@ -31,7 +31,7 @@ |
1538 | namespace oif{ |
1539 | namespace frame { |
1540 | |
1541 | -class Window : public std::enable_shared_from_this<Window> { |
1542 | +class Window { |
1543 | public: |
1544 | Window(); |
1545 | virtual ~Window() {}; |
1546 | |
1547 | === modified file 'src/x11/device_x11.cpp' |
1548 | --- src/x11/device_x11.cpp 2012-06-21 19:41:40 +0000 |
1549 | +++ src/x11/device_x11.cpp 2012-11-08 16:29:22 +0000 |
1550 | @@ -135,9 +135,6 @@ |
1551 | } |
1552 | } |
1553 | |
1554 | - value = new Value(static_cast<unsigned int>(axes_.size())); |
1555 | - InsertProperty(UFDevicePropertyNumAxes, value); |
1556 | - |
1557 | /* X11 doesn't provide us the real physical resolution of the display */ |
1558 | value = new Value(0.f); |
1559 | InsertProperty(UFDevicePropertyWindowResolutionX, value); |
1560 | |
1561 | === modified file 'src/x11/window_x11.cpp' |
1562 | --- src/x11/window_x11.cpp 2012-07-24 20:47:15 +0000 |
1563 | +++ src/x11/window_x11.cpp 2012-11-08 16:29:22 +0000 |
1564 | @@ -76,7 +76,7 @@ |
1565 | return false; |
1566 | } |
1567 | |
1568 | - *frame = SharedUFFrame(new UFFrame(shared_from_this(), current_frame_)); |
1569 | + *frame = SharedUFFrame(new UFFrame(current_frame_)); |
1570 | |
1571 | const Value* value = new Value(frame_x11_create_window_id(window_)); |
1572 | (*frame)->InsertProperty(UFFramePropertyWindowId, value); |
1573 | @@ -145,7 +145,7 @@ |
1574 | |
1575 | bool WindowX11::HandleOwnershipEvent(const XITouchOwnershipEvent* event, |
1576 | SharedUFFrame* frame) { |
1577 | - *frame = SharedUFFrame(new UFFrame(shared_from_this(), current_frame_)); |
1578 | + *frame = SharedUFFrame(new UFFrame(current_frame_)); |
1579 | |
1580 | const Value* value = new Value(frame_x11_create_window_id(window_)); |
1581 | (*frame)->InsertProperty(UFFramePropertyWindowId, value); |
1582 | |
1583 | === modified file 'test/Makefile.in' |
1584 | --- test/Makefile.in 2012-07-26 18:35:10 +0000 |
1585 | +++ test/Makefile.in 2012-11-08 16:29:22 +0000 |
1586 | @@ -1,4 +1,4 @@ |
1587 | -# Makefile.in generated by automake 1.11.5 from Makefile.am. |
1588 | +# Makefile.in generated by automake 1.11.6 from Makefile.am. |
1589 | # @configure_input@ |
1590 | |
1591 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, |
1592 | |
1593 | === modified file 'test/gtest/Makefile.in' |
1594 | --- test/gtest/Makefile.in 2012-07-26 18:35:10 +0000 |
1595 | +++ test/gtest/Makefile.in 2012-11-08 16:29:22 +0000 |
1596 | @@ -1,4 +1,4 @@ |
1597 | -# Makefile.in generated by automake 1.11.5 from Makefile.am. |
1598 | +# Makefile.in generated by automake 1.11.6 from Makefile.am. |
1599 | # @configure_input@ |
1600 | |
1601 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, |
1602 | |
1603 | === modified file 'test/integration/Makefile.in' |
1604 | --- test/integration/Makefile.in 2012-07-26 18:35:10 +0000 |
1605 | +++ test/integration/Makefile.in 2012-11-08 16:29:22 +0000 |
1606 | @@ -1,4 +1,4 @@ |
1607 | -# Makefile.in generated by automake 1.11.5 from Makefile.am. |
1608 | +# Makefile.in generated by automake 1.11.6 from Makefile.am. |
1609 | # @configure_input@ |
1610 | |
1611 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, |
1612 | |
1613 | === modified file 'test/regular/Makefile.am' |
1614 | --- test/regular/Makefile.am 2012-07-25 22:36:11 +0000 |
1615 | +++ test/regular/Makefile.am 2012-11-08 16:29:22 +0000 |
1616 | @@ -38,6 +38,7 @@ |
1617 | |
1618 | check_regular_SOURCES = \ |
1619 | accept-ended-touch.cpp \ |
1620 | + backend.cpp \ |
1621 | frame-fixture.cpp \ |
1622 | frame-fixture.h |
1623 | |
1624 | |
1625 | === modified file 'test/regular/Makefile.in' |
1626 | --- test/regular/Makefile.in 2012-07-26 18:35:10 +0000 |
1627 | +++ test/regular/Makefile.in 2012-11-08 16:29:22 +0000 |
1628 | @@ -1,4 +1,4 @@ |
1629 | -# Makefile.in generated by automake 1.11.5 from Makefile.am. |
1630 | +# Makefile.in generated by automake 1.11.6 from Makefile.am. |
1631 | # @configure_input@ |
1632 | |
1633 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, |
1634 | @@ -84,6 +84,7 @@ |
1635 | check_cxx_compile_DEPENDENCIES = $(top_builddir)/src/libframe.la \ |
1636 | $(am__DEPENDENCIES_1) |
1637 | am_check_regular_OBJECTS = check_regular-accept-ended-touch.$(OBJEXT) \ |
1638 | + check_regular-backend.$(OBJEXT) \ |
1639 | check_regular-frame-fixture.$(OBJEXT) |
1640 | check_regular_OBJECTS = $(am_check_regular_OBJECTS) |
1641 | check_regular_DEPENDENCIES = $(top_builddir)/src/.libs/libframe.a \ |
1642 | @@ -340,6 +341,7 @@ |
1643 | ### check-regular |
1644 | check_regular_SOURCES = \ |
1645 | accept-ended-touch.cpp \ |
1646 | + backend.cpp \ |
1647 | frame-fixture.cpp \ |
1648 | frame-fixture.h |
1649 | |
1650 | @@ -426,6 +428,7 @@ |
1651 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check-cxx-compile.Po@am__quote@ |
1652 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check-static-type-checking.Po@am__quote@ |
1653 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_regular-accept-ended-touch.Po@am__quote@ |
1654 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_regular-backend.Po@am__quote@ |
1655 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_regular-frame-fixture.Po@am__quote@ |
1656 | |
1657 | .c.o: |
1658 | @@ -484,6 +487,20 @@ |
1659 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ |
1660 | @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(check_regular_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o check_regular-accept-ended-touch.obj `if test -f 'accept-ended-touch.cpp'; then $(CYGPATH_W) 'accept-ended-touch.cpp'; else $(CYGPATH_W) '$(srcdir)/accept-ended-touch.cpp'; fi` |
1661 | |
1662 | +check_regular-backend.o: backend.cpp |
1663 | +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(check_regular_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT check_regular-backend.o -MD -MP -MF $(DEPDIR)/check_regular-backend.Tpo -c -o check_regular-backend.o `test -f 'backend.cpp' || echo '$(srcdir)/'`backend.cpp |
1664 | +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/check_regular-backend.Tpo $(DEPDIR)/check_regular-backend.Po |
1665 | +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='backend.cpp' object='check_regular-backend.o' libtool=no @AMDEPBACKSLASH@ |
1666 | +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ |
1667 | +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(check_regular_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o check_regular-backend.o `test -f 'backend.cpp' || echo '$(srcdir)/'`backend.cpp |
1668 | + |
1669 | +check_regular-backend.obj: backend.cpp |
1670 | +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(check_regular_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT check_regular-backend.obj -MD -MP -MF $(DEPDIR)/check_regular-backend.Tpo -c -o check_regular-backend.obj `if test -f 'backend.cpp'; then $(CYGPATH_W) 'backend.cpp'; else $(CYGPATH_W) '$(srcdir)/backend.cpp'; fi` |
1671 | +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/check_regular-backend.Tpo $(DEPDIR)/check_regular-backend.Po |
1672 | +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='backend.cpp' object='check_regular-backend.obj' libtool=no @AMDEPBACKSLASH@ |
1673 | +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ |
1674 | +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(check_regular_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o check_regular-backend.obj `if test -f 'backend.cpp'; then $(CYGPATH_W) 'backend.cpp'; else $(CYGPATH_W) '$(srcdir)/backend.cpp'; fi` |
1675 | + |
1676 | check_regular-frame-fixture.o: frame-fixture.cpp |
1677 | @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(check_regular_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT check_regular-frame-fixture.o -MD -MP -MF $(DEPDIR)/check_regular-frame-fixture.Tpo -c -o check_regular-frame-fixture.o `test -f 'frame-fixture.cpp' || echo '$(srcdir)/'`frame-fixture.cpp |
1678 | @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/check_regular-frame-fixture.Tpo $(DEPDIR)/check_regular-frame-fixture.Po |
1679 | |
1680 | === added file 'test/regular/backend.cpp' |
1681 | --- test/regular/backend.cpp 1970-01-01 00:00:00 +0000 |
1682 | +++ test/regular/backend.cpp 2012-11-08 16:29:22 +0000 |
1683 | @@ -0,0 +1,289 @@ |
1684 | +#include <gtest/gtest.h> |
1685 | +#include "oif/frame_backend.h" |
1686 | + |
1687 | +TEST(Backend, Touch) |
1688 | +{ |
1689 | + UFStatus status; |
1690 | + |
1691 | + UFBackendTouch touch_backend = frame_backend_touch_new(); |
1692 | + ASSERT_TRUE(touch_backend != nullptr); |
1693 | + |
1694 | + UFTouch touch = frame_backend_touch_get_touch(touch_backend); |
1695 | + ASSERT_TRUE(touch != nullptr); |
1696 | + |
1697 | + ASSERT_EQ(UFTouchStateBegin, frame_touch_get_state(touch)); |
1698 | + |
1699 | + frame_backend_touch_set_id(touch_backend, 123); |
1700 | + ASSERT_EQ(123, frame_touch_get_id(touch)); |
1701 | + |
1702 | + frame_backend_touch_set_ended(touch_backend); |
1703 | + ASSERT_EQ(UFTouchStateEnd, frame_touch_get_state(touch)); |
1704 | + |
1705 | + frame_backend_touch_set_window_pos(touch_backend, 1.2f, 3.4f); |
1706 | + ASSERT_EQ(1.2f, frame_touch_get_window_x(touch)); |
1707 | + ASSERT_EQ(3.4f, frame_touch_get_window_y(touch)); |
1708 | + |
1709 | + frame_backend_touch_set_time(touch_backend, 852); |
1710 | + ASSERT_EQ(852, frame_touch_get_time(touch)); |
1711 | + |
1712 | + frame_backend_touch_set_start_time(touch_backend, 555); |
1713 | + ASSERT_EQ(555, frame_touch_get_start_time(touch)); |
1714 | + |
1715 | + frame_backend_touch_set_owned(touch_backend, 1); |
1716 | + int owned = 0; |
1717 | + status = frame_touch_get_property(touch, UFTouchPropertyOwned, &owned); |
1718 | + ASSERT_EQ(UFStatusSuccess, status); |
1719 | + ASSERT_EQ(1, owned); |
1720 | + |
1721 | + frame_backend_touch_set_pending_end(touch_backend, 1); |
1722 | + int pending_end = 0; |
1723 | + status = frame_touch_get_property(touch, UFTouchPropertyPendingEnd, &pending_end); |
1724 | + ASSERT_EQ(UFStatusSuccess, status); |
1725 | + ASSERT_EQ(1, pending_end); |
1726 | + |
1727 | + frame_backend_touch_set_value(touch_backend, UFAxisTypeTouchMajor, 987.6f); |
1728 | + float touch_major = 0.0f; |
1729 | + status = frame_touch_get_value(touch, UFAxisTypeTouchMajor, &touch_major); |
1730 | + ASSERT_EQ(UFStatusSuccess, status); |
1731 | + ASSERT_EQ(987.6f, touch_major); |
1732 | + |
1733 | + /* clean up */ |
1734 | + UFBackendFrame frame = frame_backend_frame_new(); |
1735 | + frame_backend_frame_give_touch(frame, &touch_backend); |
1736 | + frame_backend_frame_delete(frame); |
1737 | +} |
1738 | + |
1739 | +TEST(Backend, Device) |
1740 | +{ |
1741 | + UFStatus status; |
1742 | + |
1743 | + UFBackendDevice device_backend = frame_backend_device_new(); |
1744 | + ASSERT_NE(nullptr, device_backend); |
1745 | + |
1746 | + UFDevice device = frame_backend_device_get_device(device_backend); |
1747 | + ASSERT_NE(nullptr, device); |
1748 | + |
1749 | + const char *name = nullptr; |
1750 | + status = frame_device_get_property(device, UFDevicePropertyName, &name); |
1751 | + ASSERT_EQ(UFStatusErrorUnknownProperty, status); |
1752 | + frame_backend_device_set_name(device_backend, "Hello World"); |
1753 | + status = frame_device_get_property(device, UFDevicePropertyName, &name); |
1754 | + ASSERT_EQ(UFStatusSuccess, status); |
1755 | + ASSERT_STREQ("Hello World", name); |
1756 | + |
1757 | + int direct = 0; |
1758 | + status = frame_device_get_property(device, UFDevicePropertyDirect, &direct); |
1759 | + ASSERT_EQ(UFStatusErrorUnknownProperty, status); |
1760 | + frame_backend_device_set_direct(device_backend, 1); |
1761 | + status = frame_device_get_property(device, UFDevicePropertyDirect, &direct); |
1762 | + ASSERT_EQ(UFStatusSuccess, status); |
1763 | + ASSERT_EQ(1, direct); |
1764 | + |
1765 | + int independent = 0; |
1766 | + status = frame_device_get_property(device, UFDevicePropertyIndependent, &independent); |
1767 | + ASSERT_EQ(UFStatusErrorUnknownProperty, status); |
1768 | + frame_backend_device_set_independent(device_backend, 1); |
1769 | + status = frame_device_get_property(device, UFDevicePropertyIndependent, &independent); |
1770 | + ASSERT_EQ(UFStatusSuccess, status); |
1771 | + ASSERT_EQ(1, independent); |
1772 | + |
1773 | + int semi_mt = 0; |
1774 | + status = frame_device_get_property(device, UFDevicePropertySemiMT, &semi_mt); |
1775 | + ASSERT_EQ(UFStatusErrorUnknownProperty, status); |
1776 | + frame_backend_device_set_semi_mt(device_backend, 1); |
1777 | + status = frame_device_get_property(device, UFDevicePropertySemiMT, &semi_mt); |
1778 | + ASSERT_EQ(UFStatusSuccess, status); |
1779 | + ASSERT_EQ(1, semi_mt); |
1780 | + |
1781 | + unsigned int max_touches = 0; |
1782 | + status = frame_device_get_property(device, UFDevicePropertyMaxTouches, &max_touches); |
1783 | + ASSERT_EQ(UFStatusErrorUnknownProperty, status); |
1784 | + frame_backend_device_set_max_touches(device_backend, 5); |
1785 | + status = frame_device_get_property(device, UFDevicePropertyMaxTouches, &max_touches); |
1786 | + ASSERT_EQ(UFStatusSuccess, status); |
1787 | + ASSERT_EQ(5, max_touches); |
1788 | + |
1789 | + frame_backend_device_set_window_resolution(device_backend, 1024.0f, 768.0f); |
1790 | + ASSERT_EQ(1024.0f, frame_device_get_window_resolution_x(device)); |
1791 | + ASSERT_EQ(768.0f, frame_device_get_window_resolution_y(device)); |
1792 | + |
1793 | + unsigned int num_axes = 0; |
1794 | + status = frame_device_get_property(device, UFDevicePropertyNumAxes, &num_axes); |
1795 | + ASSERT_EQ(UFStatusSuccess, status); |
1796 | + ASSERT_EQ(0, num_axes); |
1797 | + frame_backend_device_add_axis(device_backend, |
1798 | + UFAxisTypePressure, 1.0f, 1000.0f, 3.5f); |
1799 | + status = frame_device_get_property(device, UFDevicePropertyNumAxes, &num_axes); |
1800 | + ASSERT_EQ(UFStatusSuccess, status); |
1801 | + ASSERT_EQ(1, num_axes); |
1802 | + UFAxis axis = nullptr; |
1803 | + status = frame_device_get_axis_by_type(device, UFAxisTypePressure, &axis); |
1804 | + ASSERT_EQ(UFStatusSuccess, status); |
1805 | + ASSERT_NE(nullptr, axis); |
1806 | + ASSERT_EQ(UFAxisTypePressure, frame_axis_get_type(axis)); |
1807 | + ASSERT_EQ(1.0f, frame_axis_get_minimum(axis)); |
1808 | + ASSERT_EQ(1000.0f, frame_axis_get_maximum(axis)); |
1809 | + ASSERT_EQ(3.5f, frame_axis_get_resolution(axis)); |
1810 | + |
1811 | + frame_backend_device_delete(device_backend); |
1812 | +} |
1813 | + |
1814 | +TEST(Backend, Frame) |
1815 | +{ |
1816 | + UFStatus status; |
1817 | + |
1818 | + UFBackendFrame frame_backend = frame_backend_frame_new(); |
1819 | + ASSERT_NE(nullptr, frame_backend); |
1820 | + |
1821 | + UFFrame frame = frame_backend_frame_get_frame(frame_backend); |
1822 | + ASSERT_NE(nullptr, frame); |
1823 | + |
1824 | + UFBackendDevice device_backend = frame_backend_device_new(); |
1825 | + UFDevice device = frame_backend_device_get_device(device_backend); |
1826 | + |
1827 | + frame_backend_frame_set_device(frame_backend, device_backend); |
1828 | + ASSERT_EQ(device, frame_frame_get_device(frame)); |
1829 | + |
1830 | + frame_backend_frame_set_window_id(frame_backend, 123); |
1831 | + ASSERT_EQ(123, frame_frame_get_window_id(frame)); |
1832 | + |
1833 | + |
1834 | + unsigned int active_touches = 0; |
1835 | + UFBackendTouch touch_backend = frame_backend_touch_new(); |
1836 | + UFTouch touch = frame_backend_touch_get_touch(touch_backend); |
1837 | + frame_backend_touch_set_id(touch_backend, 10); |
1838 | + UFTouch touch_retrieved = nullptr; |
1839 | + ASSERT_EQ(0, frame_frame_get_num_touches(frame)); |
1840 | + status = frame_frame_get_property(frame, UFFramePropertyActiveTouches, &active_touches); |
1841 | + ASSERT_EQ(UFStatusSuccess, status); |
1842 | + ASSERT_EQ(0, active_touches); |
1843 | + status = frame_backend_frame_give_touch(frame_backend, &touch_backend); |
1844 | + ASSERT_EQ(UFStatusSuccess, status); |
1845 | + ASSERT_EQ(nullptr, touch_backend); |
1846 | + ASSERT_EQ(1, frame_frame_get_num_touches(frame)); |
1847 | + status = frame_frame_get_property(frame, UFFramePropertyActiveTouches, &active_touches); |
1848 | + ASSERT_EQ(UFStatusSuccess, status); |
1849 | + ASSERT_EQ(1, active_touches); |
1850 | + status = frame_frame_get_touch_by_id(frame, 10, &touch_retrieved); |
1851 | + ASSERT_EQ(UFStatusSuccess, status); |
1852 | + ASSERT_EQ(touch, touch_retrieved); |
1853 | + |
1854 | + frame_backend_frame_set_active_touches(frame_backend, 3); |
1855 | + status = frame_frame_get_property(frame, UFFramePropertyActiveTouches, &active_touches); |
1856 | + ASSERT_EQ(UFStatusSuccess, status); |
1857 | + ASSERT_EQ(3, active_touches); |
1858 | + |
1859 | + frame_backend_frame_delete(frame_backend); |
1860 | + frame_backend_device_delete(device_backend); |
1861 | +} |
1862 | + |
1863 | +TEST(Backend, FrameBorrowInexistentTouch) |
1864 | +{ |
1865 | + UFStatus status; |
1866 | + |
1867 | + UFBackendFrame frame_backend = frame_backend_frame_new(); |
1868 | + |
1869 | + UFBackendTouch touch_backend; |
1870 | + status = frame_backend_frame_borrow_touch_by_id(frame_backend, 123, &touch_backend); |
1871 | + ASSERT_EQ(UFStatusErrorInvalidTouch, status); |
1872 | + |
1873 | + /* clean up */ |
1874 | + frame_backend_frame_delete(frame_backend); |
1875 | +} |
1876 | + |
1877 | +TEST(Backend, FrameCreateNext) |
1878 | +{ |
1879 | + UFStatus status; |
1880 | + |
1881 | + /* frame 1 */ |
1882 | + UFBackendTouch touch_backend = frame_backend_touch_new(); |
1883 | + frame_backend_touch_set_id(touch_backend, 1); |
1884 | + UFTouch frame1_touch = frame_backend_touch_get_touch(touch_backend); |
1885 | + |
1886 | + UFBackendFrame frame1_backend = frame_backend_frame_new(); |
1887 | + status = frame_backend_frame_give_touch(frame1_backend, &touch_backend); |
1888 | + ASSERT_EQ(UFStatusSuccess, status); |
1889 | + |
1890 | + /* frame 2 */ |
1891 | + UFBackendFrame frame2_backend = frame_backend_frame_create_next(frame1_backend); |
1892 | + UFFrame frame2 = frame_backend_frame_get_frame(frame2_backend); |
1893 | + |
1894 | + UFTouch frame2_touch; |
1895 | + status = frame_frame_get_touch_by_id(frame2, 1, &frame2_touch); |
1896 | + ASSERT_EQ(UFStatusSuccess, status); |
1897 | + |
1898 | + /* frame 3 */ |
1899 | + UFBackendFrame frame3_backend = frame_backend_frame_create_next(frame2_backend); |
1900 | + UFFrame frame3 = frame_backend_frame_get_frame(frame3_backend); |
1901 | + |
1902 | + UFTouch frame3_touch; |
1903 | + status = frame_frame_get_touch_by_id(frame3, 1, &frame3_touch); |
1904 | + ASSERT_EQ(UFStatusSuccess, status); |
1905 | + |
1906 | + /* frame 4 */ |
1907 | + UFBackendFrame frame4_backend = frame_backend_frame_create_next(frame3_backend); |
1908 | + |
1909 | + status = frame_backend_frame_borrow_touch_by_id(frame4_backend, 1, &touch_backend); |
1910 | + ASSERT_EQ(UFStatusSuccess, status); |
1911 | + frame_backend_touch_set_ended(touch_backend); |
1912 | + status = frame_backend_frame_give_touch(frame4_backend, &touch_backend); |
1913 | + ASSERT_EQ(UFStatusSuccess, status); |
1914 | + |
1915 | + UFFrame frame4 = frame_backend_frame_get_frame(frame4_backend); |
1916 | + UFTouch frame4_touch; |
1917 | + status = frame_frame_get_touch_by_id(frame4, 1, &frame4_touch); |
1918 | + ASSERT_EQ(UFStatusSuccess, status); |
1919 | + |
1920 | + /* frame 5 */ |
1921 | + UFBackendFrame frame5_backend = frame_backend_frame_create_next(frame4_backend); |
1922 | + UFFrame frame5 = frame_backend_frame_get_frame(frame5_backend); |
1923 | + |
1924 | + /* Test the status of touch 1 throughout all frames */ |
1925 | + ASSERT_EQ(UFTouchStateBegin, frame_touch_get_state(frame1_touch)); |
1926 | + ASSERT_EQ(UFTouchStateUpdate, frame_touch_get_state(frame2_touch)); |
1927 | + ASSERT_EQ(UFTouchStateUpdate, frame_touch_get_state(frame3_touch)); |
1928 | + ASSERT_EQ(frame2_touch, frame3_touch); |
1929 | + ASSERT_EQ(UFTouchStateEnd, frame_touch_get_state(frame4_touch)); |
1930 | + ASSERT_EQ(0, frame_frame_get_num_touches(frame5)); |
1931 | + |
1932 | + /* clean up */ |
1933 | + frame_backend_frame_delete(frame1_backend); |
1934 | + frame_backend_frame_delete(frame2_backend); |
1935 | + frame_backend_frame_delete(frame3_backend); |
1936 | + frame_backend_frame_delete(frame4_backend); |
1937 | + frame_backend_frame_delete(frame5_backend); |
1938 | +} |
1939 | + |
1940 | +TEST(Backend, Event) |
1941 | +{ |
1942 | + UFStatus status; |
1943 | + |
1944 | + UFEvent event = frame_event_new(); |
1945 | + ASSERT_NE(nullptr, event); |
1946 | + |
1947 | + frame_event_set_type(event, UFEventTypeDeviceRemoved); |
1948 | + ASSERT_EQ(UFEventTypeDeviceRemoved, frame_event_get_type(event)); |
1949 | + |
1950 | + UFBackendDevice device_backend = frame_backend_device_new(); |
1951 | + UFDevice device = frame_backend_device_get_device(device_backend); |
1952 | + UFDevice device_retrieved = nullptr; |
1953 | + frame_event_set_device(event, device_backend); |
1954 | + status = frame_event_get_property(event, UFEventPropertyDevice, &device_retrieved); |
1955 | + ASSERT_EQ(UFStatusSuccess, status); |
1956 | + ASSERT_EQ(device, device_retrieved); |
1957 | + |
1958 | + UFBackendFrame frame_backend = frame_backend_frame_new(); |
1959 | + UFFrame frame = frame_backend_frame_get_frame(frame_backend); |
1960 | + UFFrame frame_retrieved = nullptr; |
1961 | + frame_event_set_frame(event, frame_backend); |
1962 | + status = frame_event_get_property(event, UFEventPropertyFrame, &frame_retrieved); |
1963 | + ASSERT_EQ(UFStatusSuccess, status); |
1964 | + ASSERT_EQ(frame, frame_retrieved); |
1965 | + |
1966 | + frame_event_set_time(event, 1234); |
1967 | + ASSERT_EQ(1234, frame_event_get_time(event)); |
1968 | + |
1969 | + frame_event_unref(event); |
1970 | + frame_backend_device_delete(device_backend); |
1971 | + frame_backend_frame_delete(frame_backend); |
1972 | +} |
1973 | |
1974 | === modified file 'test/regular/frame-fixture.cpp' |
1975 | --- test/regular/frame-fixture.cpp 2012-07-17 14:27:23 +0000 |
1976 | +++ test/regular/frame-fixture.cpp 2012-11-08 16:29:22 +0000 |
1977 | @@ -106,6 +106,10 @@ |
1978 | |
1979 | status = frame_x11_process_event(frame_handle, &xcookie); |
1980 | ASSERT_EQ(UFStatusSuccess, status); |
1981 | + |
1982 | + free(device_event->valuators.mask); |
1983 | + free(device_event->valuators.values); |
1984 | + free(device_event); |
1985 | } |
1986 | |
1987 | void FrameFixture::SendTouchOwnershipEvent(int touch_id) |
1988 | @@ -133,6 +137,8 @@ |
1989 | |
1990 | status = frame_x11_process_event(frame_handle, &xcookie); |
1991 | ASSERT_EQ(UFStatusSuccess, status); |
1992 | + |
1993 | + free(ownership_event); |
1994 | } |
1995 | |
1996 | void FrameFixture::FetchDeviceAddedEvent(UFDevice *device) |
1997 | |
1998 | === modified file 'test/x11_mocks/Makefile.in' |
1999 | --- test/x11_mocks/Makefile.in 2012-07-26 18:35:10 +0000 |
2000 | +++ test/x11_mocks/Makefile.in 2012-11-08 16:29:22 +0000 |
2001 | @@ -1,4 +1,4 @@ |
2002 | -# Makefile.in generated by automake 1.11.5 from Makefile.am. |
2003 | +# Makefile.in generated by automake 1.11.6 from Makefile.am. |
2004 | # @configure_input@ |
2005 | |
2006 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, |
2007 | |
2008 | === modified file 'tools/Makefile.in' |
2009 | --- tools/Makefile.in 2012-07-26 18:43:01 +0000 |
2010 | +++ tools/Makefile.in 2012-11-08 16:29:22 +0000 |
2011 | @@ -1,4 +1,4 @@ |
2012 | -# Makefile.in generated by automake 1.11.5 from Makefile.am. |
2013 | +# Makefile.in generated by automake 1.11.6 from Makefile.am. |
2014 | # @configure_input@ |
2015 | |
2016 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, |
2017 | |
2018 | === modified file 'tools/frame-test-x11.1' |
2019 | --- tools/frame-test-x11.1 2012-07-26 18:35:10 +0000 |
2020 | +++ tools/frame-test-x11.1 2012-11-08 16:29:22 +0000 |
2021 | @@ -2,12 +2,12 @@ |
2022 | .\" Title: frame-test-x11 |
2023 | .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] |
2024 | .\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/> |
2025 | -.\" Date: 07/25/2012 |
2026 | +.\" Date: 11/08/2012 |
2027 | .\" Manual: \ \& |
2028 | .\" Source: \ \& |
2029 | .\" Language: English |
2030 | .\" |
2031 | -.TH "FRAME\-TEST\-X11" "1" "07/25/2012" "\ \&" "\ \&" |
2032 | +.TH "FRAME\-TEST\-X11" "1" "11/08/2012" "\ \&" "\ \&" |
2033 | .\" ----------------------------------------------------------------- |
2034 | .\" * Define some portability stuff |
2035 | .\" ----------------------------------------------------------------- |
Looks good, builds cleanly.