diff options
| author | Henrik Rydberg <rydberg@euromail.se> | 2010-12-30 17:58:01 +0100 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@euromail.se> | 2010-12-30 17:58:01 +0100 |
| commit | f0aba58c91933a4702a7cc74f7daf4192868f570 (patch) | |
| tree | 648c41fe09adb72344769dd6242638cbad835482 | |
Initial load of utouch-framev1.0.0
Compiles and runs on mtdev. ABI proof.
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
| -rw-r--r-- | .gitignore | 81 | ||||
| -rw-r--r-- | COPYING | 672 | ||||
| -rw-r--r-- | INSTALL | 25 | ||||
| -rw-r--r-- | Makefile.am | 14 | ||||
| -rw-r--r-- | README | 7 | ||||
| -rwxr-xr-x | autogen.sh | 11 | ||||
| -rw-r--r-- | configure.ac | 33 | ||||
| -rw-r--r-- | docs/event-semantics.txt | 31 | ||||
| -rw-r--r-- | include/utouch/frame-mtdev.h | 39 | ||||
| -rw-r--r-- | include/utouch/frame.h | 250 | ||||
| -rw-r--r-- | src/Makefile.am | 21 | ||||
| -rw-r--r-- | src/frame-impl.h | 18 | ||||
| -rw-r--r-- | src/frame-mtdev.c | 189 | ||||
| -rw-r--r-- | src/frame.c | 303 | ||||
| -rw-r--r-- | test/Makefile.am | 0 | ||||
| -rw-r--r-- | tools/Makefile.am | 7 | ||||
| -rw-r--r-- | tools/utouch-frame-test-mtdev.c | 202 | ||||
| -rw-r--r-- | utouch-frame.pc.in | 9 |
18 files changed, 1912 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cf601fa --- /dev/null +++ b/.gitignore | |||
| @@ -0,0 +1,81 @@ | |||
| 1 | # | ||
| 2 | # X.Org module default exclusion patterns | ||
| 3 | # The next section if for module specific patterns | ||
| 4 | # | ||
| 5 | # Do not edit the following section | ||
| 6 | # GNU Build System (Autotools) | ||
| 7 | aclocal.m4 | ||
| 8 | autom4te.cache/ | ||
| 9 | autoscan.log | ||
| 10 | ChangeLog | ||
| 11 | compile | ||
| 12 | config.guess | ||
| 13 | config.h | ||
| 14 | config.h.in | ||
| 15 | config.log | ||
| 16 | config-ml.in | ||
| 17 | config.py | ||
| 18 | config.status | ||
| 19 | config.status.lineno | ||
| 20 | config.sub | ||
| 21 | configure | ||
| 22 | configure.scan | ||
| 23 | depcomp | ||
| 24 | .deps/ | ||
| 25 | install-sh | ||
| 26 | .libs/ | ||
| 27 | libtool | ||
| 28 | libtool.m4 | ||
| 29 | ltmain.sh | ||
| 30 | lt~obsolete.m4 | ||
| 31 | ltoptions.m4 | ||
| 32 | ltsugar.m4 | ||
| 33 | ltversion.m4 | ||
| 34 | Makefile | ||
| 35 | Makefile.in | ||
| 36 | mdate-sh | ||
| 37 | missing | ||
| 38 | mkinstalldirs | ||
| 39 | *.pc | ||
| 40 | py-compile | ||
| 41 | stamp-h? | ||
| 42 | symlink-tree | ||
| 43 | texinfo.tex | ||
| 44 | ylwrap | ||
| 45 | |||
| 46 | # Do not edit the following section | ||
| 47 | # Edit Compile Debug Document Distribute | ||
| 48 | *~ | ||
| 49 | *.[0-9] | ||
| 50 | *.[0-9]x | ||
| 51 | *.bak | ||
| 52 | *.bin | ||
| 53 | core | ||
| 54 | *.dll | ||
| 55 | *.exe | ||
| 56 | *-ISO*.bdf | ||
| 57 | *-JIS*.bdf | ||
| 58 | *-KOI8*.bdf | ||
| 59 | *.kld | ||
| 60 | *.ko | ||
| 61 | *.ko.cmd | ||
| 62 | *.lai | ||
| 63 | *.l[oa] | ||
| 64 | *.[oa] | ||
| 65 | *.obj | ||
| 66 | *.patch | ||
| 67 | *.so | ||
| 68 | *.pcf.gz | ||
| 69 | *.pdb | ||
| 70 | *.tar.bz2 | ||
| 71 | *.tar.gz | ||
| 72 | # | ||
| 73 | # Add & Override patterns for mtdev | ||
| 74 | # | ||
| 75 | # Edit the following section as needed | ||
| 76 | # For example, !report.pc overrides *.pc. See 'man gitignore' | ||
| 77 | # | ||
| 78 | .bzrignore | ||
| 79 | .bzr | ||
| 80 | patches | ||
| 81 | tools/utouch-frame-test-mtdev | ||
| @@ -0,0 +1,672 @@ | |||
| 1 | utouch-frame - Touch Frame Library (GPLv3 license) | ||
| 2 | |||
| 3 | Copyright (C) 2010 Canonical Ltd. | ||
| 4 | Copyright (C) 2010 Henrik Rydberg <rydberg@bitmath.org> | ||
| 5 | |||
| 6 | Preamble | ||
| 7 | |||
| 8 | The GNU General Public License is a free, copyleft license for | ||
| 9 | software and other kinds of works. | ||
| 10 | |||
| 11 | The licenses for most software and other practical works are designed | ||
| 12 | to take away your freedom to share and change the works. By contrast, | ||
| 13 | the GNU General Public License is intended to guarantee your freedom to | ||
| 14 | share and change all versions of a program--to make sure it remains free | ||
| 15 | software for all its users. We, the Free Software Foundation, use the | ||
| 16 | GNU General Public License for most of our software; it applies also to | ||
| 17 | any other work released this way by its authors. You can apply it to | ||
| 18 | your programs, too. | ||
| 19 | |||
| 20 | When we speak of free software, we are referring to freedom, not | ||
| 21 | price. Our General Public Licenses are designed to make sure that you | ||
| 22 | have the freedom to distribute copies of free software (and charge for | ||
| 23 | them if you wish), that you receive source code or can get it if you | ||
| 24 | want it, that you can change the software or use pieces of it in new | ||
| 25 | free programs, and that you know you can do these things. | ||
| 26 | |||
| 27 | To protect your rights, we need to prevent others from denying you | ||
| 28 | these rights or asking you to surrender the rights. Therefore, you have | ||
| 29 | certain responsibilities if you distribute copies of the software, or if | ||
| 30 | you modify it: responsibilities to respect the freedom of others. | ||
| 31 | |||
| 32 | For example, if you distribute copies of such a program, whether | ||
| 33 | gratis or for a fee, you must pass on to the recipients the same | ||
| 34 | freedoms that you received. You must make sure that they, too, receive | ||
| 35 | or can get the source code. And you must show them these terms so they | ||
| 36 | know their rights. | ||
| 37 | |||
| 38 | Developers that use the GNU GPL protect your rights with two steps: | ||
| 39 | (1) assert copyright on the software, and (2) offer you this License | ||
| 40 | giving you legal permission to copy, distribute and/or modify it. | ||
| 41 | |||
| 42 | For the developers' and authors' protection, the GPL clearly explains | ||
| 43 | that there is no warranty for this free software. For both users' and | ||
| 44 | authors' sake, the GPL requires that modified versions be marked as | ||
| 45 | changed, so that their problems will not be attributed erroneously to | ||
| 46 | authors of previous versions. | ||
| 47 | |||
| 48 | Some devices are designed to deny users access to install or run | ||
| 49 | modified versions of the software inside them, although the manufacturer | ||
| 50 | can do so. This is fundamentally incompatible with the aim of | ||
| 51 | protecting users' freedom to change the software. The systematic | ||
| 52 | pattern of such abuse occurs in the area of products for individuals to | ||
| 53 | use, which is precisely where it is most unacceptable. Therefore, we | ||
| 54 | have designed this version of the GPL to prohibit the practice for those | ||
| 55 | products. If such problems arise substantially in other domains, we | ||
| 56 | stand ready to extend this provision to those domains in future versions | ||
| 57 | of the GPL, as needed to protect the freedom of users. | ||
| 58 | |||
| 59 | Finally, every program is threatened constantly by software patents. | ||
| 60 | States should not allow patents to restrict development and use of | ||
| 61 | software on general-purpose computers, but in those that do, we wish to | ||
| 62 | avoid the special danger that patents applied to a free program could | ||
| 63 | make it effectively proprietary. To prevent this, the GPL assures that | ||
| 64 | patents cannot be used to render the program non-free. | ||
| 65 | |||
| 66 | The precise terms and conditions for copying, distribution and | ||
| 67 | modification follow. | ||
| 68 | |||
| 69 | TERMS AND CONDITIONS | ||
| 70 | |||
| 71 | 0. Definitions. | ||
| 72 | |||
| 73 | "This License" refers to version 3 of the GNU General Public License. | ||
| 74 | |||
| 75 | "Copyright" also means copyright-like laws that apply to other kinds of | ||
| 76 | works, such as semiconductor masks. | ||
| 77 | |||
| 78 | "The Program" refers to any copyrightable work licensed under this | ||
| 79 | License. Each licensee is addressed as "you". "Licensees" and | ||
| 80 | "recipients" may be individuals or organizations. | ||
| 81 | |||
| 82 | To "modify" a work means to copy from or adapt all or part of the work | ||
| 83 | in a fashion requiring copyright permission, other than the making of an | ||
| 84 | exact copy. The resulting work is called a "modified version" of the | ||
| 85 | earlier work or a work "based on" the earlier work. | ||
| 86 | |||
| 87 | A "covered work" means either the unmodified Program or a work based | ||
| 88 | on the Program. | ||
| 89 | |||
| 90 | To "propagate" a work means to do anything with it that, without | ||
| 91 | permission, would make you directly or secondarily liable for | ||
| 92 | infringement under applicable copyright law, except executing it on a | ||
| 93 | computer or modifying a private copy. Propagation includes copying, | ||
| 94 | distribution (with or without modification), making available to the | ||
| 95 | public, and in some countries other activities as well. | ||
| 96 | |||
| 97 | To "convey" a work means any kind of propagation that enables other | ||
| 98 | parties to make or receive copies. Mere interaction with a user through | ||
| 99 | a computer network, with no transfer of a copy, is not conveying. | ||
| 100 | |||
| 101 | An interactive user interface displays "Appropriate Legal Notices" | ||
| 102 | to the extent that it includes a convenient and prominently visible | ||
| 103 | feature that (1) displays an appropriate copyright notice, and (2) | ||
| 104 | tells the user that there is no warranty for the work (except to the | ||
| 105 | extent that warranties are provided), that licensees may convey the | ||
| 106 | work under this License, and how to view a copy of this License. If | ||
| 107 | the interface presents a list of user commands or options, such as a | ||
| 108 | menu, a prominent item in the list meets this criterion. | ||
| 109 | |||
| 110 | 1. Source Code. | ||
| 111 | |||
| 112 | The "source code" for a work means the preferred form of the work | ||
| 113 | for making modifications to it. "Object code" means any non-source | ||
| 114 | form of a work. | ||
| 115 | |||
| 116 | A "Standard Interface" means an interface that either is an official | ||
| 117 | standard defined by a recognized standards body, or, in the case of | ||
| 118 | interfaces specified for a particular programming language, one that | ||
| 119 | is widely used among developers working in that language. | ||
| 120 | |||
| 121 | The "System Libraries" of an executable work include anything, other | ||
| 122 | than the work as a whole, that (a) is included in the normal form of | ||
| 123 | packaging a Major Component, but which is not part of that Major | ||
| 124 | Component, and (b) serves only to enable use of the work with that | ||
| 125 | Major Component, or to implement a Standard Interface for which an | ||
| 126 | implementation is available to the public in source code form. A | ||
| 127 | "Major Component", in this context, means a major essential component | ||
| 128 | (kernel, window system, and so on) of the specific operating system | ||
| 129 | (if any) on which the executable work runs, or a compiler used to | ||
| 130 | produce the work, or an object code interpreter used to run it. | ||
| 131 | |||
| 132 | The "Corresponding Source" for a work in object code form means all | ||
| 133 | the source code needed to generate, install, and (for an executable | ||
| 134 | work) run the object code and to modify the work, including scripts to | ||
| 135 | control those activities. However, it does not include the work's | ||
| 136 | System Libraries, or general-purpose tools or generally available free | ||
| 137 | programs which are used unmodified in performing those activities but | ||
| 138 | which are not part of the work. For example, Corresponding Source | ||
| 139 | includes interface definition files associated with source files for | ||
| 140 | the work, and the source code for shared libraries and dynamically | ||
| 141 | linked subprograms that the work is specifically designed to require, | ||
| 142 | such as by intimate data communication or control flow between those | ||
| 143 | subprograms and other parts of the work. | ||
| 144 | |||
| 145 | The Corresponding Source need not include anything that users | ||
| 146 | can regenerate automatically from other parts of the Corresponding | ||
| 147 | Source. | ||
| 148 | |||
| 149 | The Corresponding Source for a work in source code form is that | ||
| 150 | same work. | ||
| 151 | |||
| 152 | 2. Basic Permissions. | ||
| 153 | |||
| 154 | All rights granted under this License are granted for the term of | ||
| 155 | copyright on the Program, and are irrevocable provided the stated | ||
| 156 | conditions are met. This License explicitly affirms your unlimited | ||
| 157 | permission to run the unmodified Program. The output from running a | ||
| 158 | covered work is covered by this License only if the output, given its | ||
| 159 | content, constitutes a covered work. This License acknowledges your | ||
| 160 | rights of fair use or other equivalent, as provided by copyright law. | ||
| 161 | |||
| 162 | You may make, run and propagate covered works that you do not | ||
| 163 | convey, without conditions so long as your license otherwise remains | ||
| 164 | in force. You may convey covered works to others for the sole purpose | ||
| 165 | of having them make modifications exclusively for you, or provide you | ||
| 166 | with facilities for running those works, provided that you comply with | ||
| 167 | the terms of this License in conveying all material for which you do | ||
| 168 | not control copyright. Those thus making or running the covered works | ||
| 169 | for you must do so exclusively on your behalf, under your direction | ||
| 170 | and control, on terms that prohibit them from making any copies of | ||
| 171 | your copyrighted material outside their relationship with you. | ||
| 172 | |||
| 173 | Conveying under any other circumstances is permitted solely under | ||
| 174 | the conditions stated below. Sublicensing is not allowed; section 10 | ||
| 175 | makes it unnecessary. | ||
| 176 | |||
| 177 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. | ||
| 178 | |||
| 179 | No covered work shall be deemed part of an effective technological | ||
| 180 | measure under any applicable law fulfilling obligations under article | ||
| 181 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or | ||
| 182 | similar laws prohibiting or restricting circumvention of such | ||
| 183 | measures. | ||
| 184 | |||
| 185 | When you convey a covered work, you waive any legal power to forbid | ||
| 186 | circumvention of technological measures to the extent such circumvention | ||
| 187 | is effected by exercising rights under this License with respect to | ||
| 188 | the covered work, and you disclaim any intention to limit operation or | ||
| 189 | modification of the work as a means of enforcing, against the work's | ||
| 190 | users, your or third parties' legal rights to forbid circumvention of | ||
| 191 | technological measures. | ||
| 192 | |||
| 193 | 4. Conveying Verbatim Copies. | ||
| 194 | |||
| 195 | You may convey verbatim copies of the Program's source code as you | ||
| 196 | receive it, in any medium, provided that you conspicuously and | ||
| 197 | appropriately publish on each copy an appropriate copyright notice; | ||
| 198 | keep intact all notices stating that this License and any | ||
| 199 | non-permissive terms added in accord with section 7 apply to the code; | ||
| 200 | keep intact all notices of the absence of any warranty; and give all | ||
| 201 | recipients a copy of this License along with the Program. | ||
| 202 | |||
| 203 | You may charge any price or no price for each copy that you convey, | ||
| 204 | and you may offer support or warranty protection for a fee. | ||
| 205 | |||
| 206 | 5. Conveying Modified Source Versions. | ||
| 207 | |||
| 208 | You may convey a work based on the Program, or the modifications to | ||
| 209 | produce it from the Program, in the form of source code under the | ||
| 210 | terms of section 4, provided that you also meet all of these conditions: | ||
| 211 | |||
| 212 | a) The work must carry prominent notices stating that you modified | ||
| 213 | it, and giving a relevant date. | ||
| 214 | |||
| 215 | b) The work must carry prominent notices stating that it is | ||
| 216 | released under this License and any conditions added under section | ||
| 217 | 7. This requirement modifies the requirement in section 4 to | ||
| 218 | "keep intact all notices". | ||
| 219 | |||
| 220 | c) You must license the entire work, as a whole, under this | ||
| 221 | License to anyone who comes into possession of a copy. This | ||
| 222 | License will therefore apply, along with any applicable section 7 | ||
| 223 | additional terms, to the whole of the work, and all its parts, | ||
| 224 | regardless of how they are packaged. This License gives no | ||
| 225 | permission to license the work in any other way, but it does not | ||
| 226 | invalidate such permission if you have separately received it. | ||
| 227 | |||
| 228 | d) If the work has interactive user interfaces, each must display | ||
| 229 | Appropriate Legal Notices; however, if the Program has interactive | ||
| 230 | interfaces that do not display Appropriate Legal Notices, your | ||
| 231 | work need not make them do so. | ||
| 232 | |||
| 233 | A compilation of a covered work with other separate and independent | ||
| 234 | works, which are not by their nature extensions of the covered work, | ||
| 235 | and which are not combined with it such as to form a larger program, | ||
| 236 | in or on a volume of a storage or distribution medium, is called an | ||
| 237 | "aggregate" if the compilation and its resulting copyright are not | ||
| 238 | used to limit the access or legal rights of the compilation's users | ||
| 239 | beyond what the individual works permit. Inclusion of a covered work | ||
| 240 | in an aggregate does not cause this License to apply to the other | ||
| 241 | parts of the aggregate. | ||
| 242 | |||
| 243 | 6. Conveying Non-Source Forms. | ||
| 244 | |||
| 245 | You may convey a covered work in object code form under the terms | ||
| 246 | of sections 4 and 5, provided that you also convey the | ||
| 247 | machine-readable Corresponding Source under the terms of this License, | ||
| 248 | in one of these ways: | ||
| 249 | |||
| 250 | a) Convey the object code in, or embodied in, a physical product | ||
| 251 | (including a physical distribution medium), accompanied by the | ||
| 252 | Corresponding Source fixed on a durable physical medium | ||
| 253 | customarily used for software interchange. | ||
| 254 | |||
| 255 | b) Convey the object code in, or embodied in, a physical product | ||
| 256 | (including a physical distribution medium), accompanied by a | ||
| 257 | written offer, valid for at least three years and valid for as | ||
| 258 | long as you offer spare parts or customer support for that product | ||
| 259 | model, to give anyone who possesses the object code either (1) a | ||
| 260 | copy of the Corresponding Source for all the software in the | ||
| 261 | product that is covered by this License, on a durable physical | ||
| 262 | medium customarily used for software interchange, for a price no | ||
| 263 | more than your reasonable cost of physically performing this | ||
| 264 | conveying of source, or (2) access to copy the | ||
| 265 | Corresponding Source from a network server at no charge. | ||
| 266 | |||
| 267 | c) Convey individual copies of the object code with a copy of the | ||
| 268 | written offer to provide the Corresponding Source. This | ||
| 269 | alternative is allowed only occasionally and noncommercially, and | ||
| 270 | only if you received the object code with such an offer, in accord | ||
| 271 | with subsection 6b. | ||
| 272 | |||
| 273 | d) Convey the object code by offering access from a designated | ||
| 274 | place (gratis or for a charge), and offer equivalent access to the | ||
| 275 | Corresponding Source in the same way through the same place at no | ||
| 276 | further charge. You need not require recipients to copy the | ||
| 277 | Corresponding Source along with the object code. If the place to | ||
| 278 | copy the object code is a network server, the Corresponding Source | ||
| 279 | may be on a different server (operated by you or a third party) | ||
| 280 | that supports equivalent copying facilities, provided you maintain | ||
| 281 | clear directions next to the object code saying where to find the | ||
| 282 | Corresponding Source. Regardless of what server hosts the | ||
| 283 | Corresponding Source, you remain obligated to ensure that it is | ||
| 284 | available for as long as needed to satisfy these requirements. | ||
| 285 | |||
| 286 | e) Convey the object code using peer-to-peer transmission, provided | ||
| 287 | you inform other peers where the object code and Corresponding | ||
| 288 | Source of the work are being offered to the general public at no | ||
| 289 | charge under subsection 6d. | ||
| 290 | |||
| 291 | A separable portion of the object code, whose source code is excluded | ||
| 292 | from the Corresponding Source as a System Library, need not be | ||
| 293 | included in conveying the object code work. | ||
| 294 | |||
| 295 | A "User Product" is either (1) a "consumer product", which means any | ||
| 296 | tangible personal property which is normally used for personal, family, | ||
| 297 | or household purposes, or (2) anything designed or sold for incorporation | ||
| 298 | into a dwelling. In determining whether a product is a consumer product, | ||
| 299 | doubtful cases shall be resolved in favor of coverage. For a particular | ||
| 300 | product received by a particular user, "normally used" refers to a | ||
| 301 | typical or common use of that class of product, regardless of the status | ||
| 302 | of the particular user or of the way in which the particular user | ||
| 303 | actually uses, or expects or is expected to use, the product. A product | ||
| 304 | is a consumer product regardless of whether the product has substantial | ||
| 305 | commercial, industrial or non-consumer uses, unless such uses represent | ||
| 306 | the only significant mode of use of the product. | ||
| 307 | |||
| 308 | "Installation Information" for a User Product means any methods, | ||
| 309 | procedures, authorization keys, or other information required to install | ||
| 310 | and execute modified versions of a covered work in that User Product from | ||
| 311 | a modified version of its Corresponding Source. The information must | ||
| 312 | suffice to ensure that the continued functioning of the modified object | ||
| 313 | code is in no case prevented or interfered with solely because | ||
| 314 | modification has been made. | ||
| 315 | |||
| 316 | If you convey an object code work under this section in, or with, or | ||
| 317 | specifically for use in, a User Product, and the conveying occurs as | ||
| 318 | part of a transaction in which the right of possession and use of the | ||
| 319 | User Product is transferred to the recipient in perpetuity or for a | ||
| 320 | fixed term (regardless of how the transaction is characterized), the | ||
| 321 | Corresponding Source conveyed under this section must be accompanied | ||
| 322 | by the Installation Information. But this requirement does not apply | ||
| 323 | if neither you nor any third party retains the ability to install | ||
| 324 | modified object code on the User Product (for example, the work has | ||
| 325 | been installed in ROM). | ||
| 326 | |||
| 327 | The requirement to provide Installation Information does not include a | ||
| 328 | requirement to continue to provide support service, warranty, or updates | ||
| 329 | for a work that has been modified or installed by the recipient, or for | ||
| 330 | the User Product in which it has been modified or installed. Access to a | ||
| 331 | network may be denied when the modification itself materially and | ||
| 332 | adversely affects the operation of the network or violates the rules and | ||
| 333 | protocols for communication across the network. | ||
| 334 | |||
| 335 | Corresponding Source conveyed, and Installation Information provided, | ||
| 336 | in accord with this section must be in a format that is publicly | ||
| 337 | documented (and with an implementation available to the public in | ||
| 338 | source code form), and must require no special password or key for | ||
| 339 | unpacking, reading or copying. | ||
| 340 | |||
| 341 | 7. Additional Terms. | ||
| 342 | |||
| 343 | "Additional permissions" are terms that supplement the terms of this | ||
| 344 | License by making exceptions from one or more of its conditions. | ||
| 345 | Additional permissions that are applicable to the entire Program shall | ||
| 346 | be treated as though they were included in this License, to the extent | ||
| 347 | that they are valid under applicable law. If additional permissions | ||
| 348 | apply only to part of the Program, that part may be used separately | ||
| 349 | under those permissions, but the entire Program remains governed by | ||
| 350 | this License without regard to the additional permissions. | ||
| 351 | |||
| 352 | When you convey a copy of a covered work, you may at your option | ||
| 353 | remove any additional permissions from that copy, or from any part of | ||
| 354 | it. (Additional permissions may be written to require their own | ||
| 355 | removal in certain cases when you modify the work.) You may place | ||
| 356 | additional permissions on material, added by you to a covered work, | ||
| 357 | for which you have or can give appropriate copyright permission. | ||
| 358 | |||
| 359 | Notwithstanding any other provision of this License, for material you | ||
| 360 | add to a covered work, you may (if authorized by the copyright holders of | ||
| 361 | that material) supplement the terms of this License with terms: | ||
| 362 | |||
| 363 | a) Disclaiming warranty or limiting liability differently from the | ||
| 364 | terms of sections 15 and 16 of this License; or | ||
| 365 | |||
| 366 | b) Requiring preservation of specified reasonable legal notices or | ||
| 367 | author attributions in that material or in the Appropriate Legal | ||
| 368 | Notices displayed by works containing it; or | ||
| 369 | |||
| 370 | c) Prohibiting misrepresentation of the origin of that material, or | ||
| 371 | requiring that modified versions of such material be marked in | ||
| 372 | reasonable ways as different from the original version; or | ||
| 373 | |||
| 374 | d) Limiting the use for publicity purposes of names of licensors or | ||
| 375 | authors of the material; or | ||
| 376 | |||
| 377 | e) Declining to grant rights under trademark law for use of some | ||
| 378 | trade names, trademarks, or service marks; or | ||
| 379 | |||
| 380 | f) Requiring indemnification of licensors and authors of that | ||
| 381 | material by anyone who conveys the material (or modified versions of | ||
| 382 | it) with contractual assumptions of liability to the recipient, for | ||
| 383 | any liability that these contractual assumptions directly impose on | ||
| 384 | those licensors and authors. | ||
| 385 | |||
| 386 | All other non-permissive additional terms are considered "further | ||
| 387 | restrictions" within the meaning of section 10. If the Program as you | ||
| 388 | received it, or any part of it, contains a notice stating that it is | ||
| 389 | governed by this License along with a term that is a further | ||
| 390 | restriction, you may remove that term. If a license document contains | ||
| 391 | a further restriction but permits relicensing or conveying under this | ||
| 392 | License, you may add to a covered work material governed by the terms | ||
| 393 | of that license document, provided that the further restriction does | ||
| 394 | not survive such relicensing or conveying. | ||
| 395 | |||
| 396 | If you add terms to a covered work in accord with this section, you | ||
| 397 | must place, in the relevant source files, a statement of the | ||
| 398 | additional terms that apply to those files, or a notice indicating | ||
| 399 | where to find the applicable terms. | ||
| 400 | |||
| 401 | Additional terms, permissive or non-permissive, may be stated in the | ||
| 402 | form of a separately written license, or stated as exceptions; | ||
| 403 | the above requirements apply either way. | ||
| 404 | |||
| 405 | 8. Termination. | ||
| 406 | |||
| 407 | You may not propagate or modify a covered work except as expressly | ||
| 408 | provided under this License. Any attempt otherwise to propagate or | ||
| 409 | modify it is void, and will automatically terminate your rights under | ||
| 410 | this License (including any patent licenses granted under the third | ||
| 411 | paragraph of section 11). | ||
| 412 | |||
| 413 | However, if you cease all violation of this License, then your | ||
| 414 | license from a particular copyright holder is reinstated (a) | ||
| 415 | provisionally, unless and until the copyright holder explicitly and | ||
| 416 | finally terminates your license, and (b) permanently, if the copyright | ||
| 417 | holder fails to notify you of the violation by some reasonable means | ||
| 418 | prior to 60 days after the cessation. | ||
| 419 | |||
| 420 | Moreover, your license from a particular copyright holder is | ||
| 421 | reinstated permanently if the copyright holder notifies you of the | ||
| 422 | violation by some reasonable means, this is the first time you have | ||
| 423 | received notice of violation of this License (for any work) from that | ||
| 424 | copyright holder, and you cure the violation prior to 30 days after | ||
| 425 | your receipt of the notice. | ||
| 426 | |||
| 427 | Termination of your rights under this section does not terminate the | ||
| 428 | licenses of parties who have received copies or rights from you under | ||
| 429 | this License. If your rights have been terminated and not permanently | ||
| 430 | reinstated, you do not qualify to receive new licenses for the same | ||
| 431 | material under section 10. | ||
| 432 | |||
| 433 | 9. Acceptance Not Required for Having Copies. | ||
| 434 | |||
| 435 | You are not required to accept this License in order to receive or | ||
| 436 | run a copy of the Program. Ancillary propagation of a covered work | ||
| 437 | occurring solely as a consequence of using peer-to-peer transmission | ||
| 438 | to receive a copy likewise does not require acceptance. However, | ||
| 439 | nothing other than this License grants you permission to propagate or | ||
| 440 | modify any covered work. These actions infringe copyright if you do | ||
| 441 | not accept this License. Therefore, by modifying or propagating a | ||
| 442 | covered work, you indicate your acceptance of this License to do so. | ||
| 443 | |||
| 444 | 10. Automatic Licensing of Downstream Recipients. | ||
| 445 | |||
| 446 | Each time you convey a covered work, the recipient automatically | ||
| 447 | receives a license from the original licensors, to run, modify and | ||
| 448 | propagate that work, subject to this License. You are not responsible | ||
| 449 | for enforcing compliance by third parties with this License. | ||
| 450 | |||
| 451 | An "entity transaction" is a transaction transferring control of an | ||
| 452 | organization, or substantially all assets of one, or subdividing an | ||
| 453 | organization, or merging organizations. If propagation of a covered | ||
| 454 | work results from an entity transaction, each party to that | ||
| 455 | transaction who receives a copy of the work also receives whatever | ||
| 456 | licenses to the work the party's predecessor in interest had or could | ||
| 457 | give under the previous paragraph, plus a right to possession of the | ||
| 458 | Corresponding Source of the work from the predecessor in interest, if | ||
| 459 | the predecessor has it or can get it with reasonable efforts. | ||
| 460 | |||
| 461 | You may not impose any further restrictions on the exercise of the | ||
| 462 | rights granted or affirmed under this License. For example, you may | ||
| 463 | not impose a license fee, royalty, or other charge for exercise of | ||
| 464 | rights granted under this License, and you may not initiate litigation | ||
| 465 | (including a cross-claim or counterclaim in a lawsuit) alleging that | ||
| 466 | any patent claim is infringed by making, using, selling, offering for | ||
| 467 | sale, or importing the Program or any portion of it. | ||
| 468 | |||
| 469 | 11. Patents. | ||
| 470 | |||
| 471 | A "contributor" is a copyright holder who authorizes use under this | ||
| 472 | License of the Program or a work on which the Program is based. The | ||
| 473 | work thus licensed is called the contributor's "contributor version". | ||
| 474 | |||
| 475 | A contributor's "essential patent claims" are all patent claims | ||
| 476 | owned or controlled by the contributor, whether already acquired or | ||
| 477 | hereafter acquired, that would be infringed by some manner, permitted | ||
| 478 | by this License, of making, using, or selling its contributor version, | ||
| 479 | but do not include claims that would be infringed only as a | ||
| 480 | consequence of further modification of the contributor version. For | ||
| 481 | purposes of this definition, "control" includes the right to grant | ||
| 482 | patent sublicenses in a manner consistent with the requirements of | ||
| 483 | this License. | ||
| 484 | |||
| 485 | Each contributor grants you a non-exclusive, worldwide, royalty-free | ||
| 486 | patent license under the contributor's essential patent claims, to | ||
| 487 | make, use, sell, offer for sale, import and otherwise run, modify and | ||
| 488 | propagate the contents of its contributor version. | ||
| 489 | |||
| 490 | In the following three paragraphs, a "patent license" is any express | ||
| 491 | agreement or commitment, however denominated, not to enforce a patent | ||
| 492 | (such as an express permission to practice a patent or covenant not to | ||
| 493 | sue for patent infringement). To "grant" such a patent license to a | ||
| 494 | party means to make such an agreement or commitment not to enforce a | ||
| 495 | patent against the party. | ||
| 496 | |||
| 497 | If you convey a covered work, knowingly relying on a patent license, | ||
| 498 | and the Corresponding Source of the work is not available for anyone | ||
| 499 | to copy, free of charge and under the terms of this License, through a | ||
| 500 | publicly available network server or other readily accessible means, | ||
| 501 | then you must either (1) cause the Corresponding Source to be so | ||
| 502 | available, or (2) arrange to deprive yourself of the benefit of the | ||
| 503 | patent license for this particular work, or (3) arrange, in a manner | ||
| 504 | consistent with the requirements of this License, to extend the patent | ||
| 505 | license to downstream recipients. "Knowingly relying" means you have | ||
| 506 | actual knowledge that, but for the patent license, your conveying the | ||
| 507 | covered work in a country, or your recipient's use of the covered work | ||
| 508 | in a country, would infringe one or more identifiable patents in that | ||
| 509 | country that you have reason to believe are valid. | ||
| 510 | |||
| 511 | If, pursuant to or in connection with a single transaction or | ||
| 512 | arrangement, you convey, or propagate by procuring conveyance of, a | ||
| 513 | covered work, and grant a patent license to some of the parties | ||
| 514 | receiving the covered work authorizing them to use, propagate, modify | ||
| 515 | or convey a specific copy of the covered work, then the patent license | ||
| 516 | you grant is automatically extended to all recipients of the covered | ||
| 517 | work and works based on it. | ||
| 518 | |||
| 519 | A patent license is "discriminatory" if it does not include within | ||
| 520 | the scope of its coverage, prohibits the exercise of, or is | ||
| 521 | conditioned on the non-exercise of one or more of the rights that are | ||
| 522 | specifically granted under this License. You may not convey a covered | ||
| 523 | work if you are a party to an arrangement with a third party that is | ||
| 524 | in the business of distributing software, under which you make payment | ||
| 525 | to the third party based on the extent of your activity of conveying | ||
| 526 | the work, and under which the third party grants, to any of the | ||
| 527 | parties who would receive the covered work from you, a discriminatory | ||
| 528 | patent license (a) in connection with copies of the covered work | ||
| 529 | conveyed by you (or copies made from those copies), or (b) primarily | ||
| 530 | for and in connection with specific products or compilations that | ||
| 531 | contain the covered work, unless you entered into that arrangement, | ||
| 532 | or that patent license was granted, prior to 28 March 2007. | ||
| 533 | |||
| 534 | Nothing in this License shall be construed as excluding or limiting | ||
| 535 | any implied license or other defenses to infringement that may | ||
| 536 | otherwise be available to you under applicable patent law. | ||
| 537 | |||
| 538 | 12. No Surrender of Others' Freedom. | ||
| 539 | |||
| 540 | If conditions are imposed on you (whether by court order, agreement or | ||
| 541 | otherwise) that contradict the conditions of this License, they do not | ||
| 542 | excuse you from the conditions of this License. If you cannot convey a | ||
| 543 | covered work so as to satisfy simultaneously your obligations under this | ||
| 544 | License and any other pertinent obligations, then as a consequence you may | ||
| 545 | not convey it at all. For example, if you agree to terms that obligate you | ||
| 546 | to collect a royalty for further conveying from those to whom you convey | ||
| 547 | the Program, the only way you could satisfy both those terms and this | ||
| 548 | License would be to refrain entirely from conveying the Program. | ||
| 549 | |||
| 550 | 13. Use with the GNU Affero General Public License. | ||
| 551 | |||
| 552 | Notwithstanding any other provision of this License, you have | ||
| 553 | permission to link or combine any covered work with a work licensed | ||
| 554 | under version 3 of the GNU Affero General Public License into a single | ||
| 555 | combined work, and to convey the resulting work. The terms of this | ||
| 556 | License will continue to apply to the part which is the covered work, | ||
| 557 | but the special requirements of the GNU Affero General Public License, | ||
| 558 | section 13, concerning interaction through a network will apply to the | ||
| 559 | combination as such. | ||
| 560 | |||
| 561 | 14. Revised Versions of this License. | ||
| 562 | |||
| 563 | The Free Software Foundation may publish revised and/or new versions of | ||
| 564 | the GNU General Public License from time to time. Such new versions will | ||
| 565 | be similar in spirit to the present version, but may differ in detail to | ||
| 566 | address new problems or concerns. | ||
| 567 | |||
| 568 | Each version is given a distinguishing version number. If the | ||
| 569 | Program specifies that a certain numbered version of the GNU General | ||
| 570 | Public License "or any later version" applies to it, you have the | ||
| 571 | option of following the terms and conditions either of that numbered | ||
| 572 | version or of any later version published by the Free Software | ||
| 573 | Foundation. If the Program does not specify a version number of the | ||
| 574 | GNU General Public License, you may choose any version ever published | ||
| 575 | by the Free Software Foundation. | ||
| 576 | |||
| 577 | If the Program specifies that a proxy can decide which future | ||
| 578 | versions of the GNU General Public License can be used, that proxy's | ||
| 579 | public statement of acceptance of a version permanently authorizes you | ||
| 580 | to choose that version for the Program. | ||
| 581 | |||
| 582 | Later license versions may give you additional or different | ||
| 583 | permissions. However, no additional obligations are imposed on any | ||
| 584 | author or copyright holder as a result of your choosing to follow a | ||
| 585 | later version. | ||
| 586 | |||
| 587 | 15. Disclaimer of Warranty. | ||
| 588 | |||
| 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY | ||
| 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT | ||
| 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY | ||
| 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, | ||
| 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM | ||
| 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF | ||
| 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. | ||
| 597 | |||
| 598 | 16. Limitation of Liability. | ||
| 599 | |||
| 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING | ||
| 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS | ||
| 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY | ||
| 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE | ||
| 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF | ||
| 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD | ||
| 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), | ||
| 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF | ||
| 608 | SUCH DAMAGES. | ||
| 609 | |||
| 610 | 17. Interpretation of Sections 15 and 16. | ||
| 611 | |||
| 612 | If the disclaimer of warranty and limitation of liability provided | ||
| 613 | above cannot be given local legal effect according to their terms, | ||
| 614 | reviewing courts shall apply local law that most closely approximates | ||
| 615 | an absolute waiver of all civil liability in connection with the | ||
| 616 | Program, unless a warranty or assumption of liability accompanies a | ||
| 617 | copy of the Program in return for a fee. | ||
| 618 | |||
| 619 | END OF TERMS AND CONDITIONS | ||
| 620 | |||
| 621 | How to Apply These Terms to Your New Programs | ||
| 622 | |||
| 623 | If you develop a new program, and you want it to be of the greatest | ||
| 624 | possible use to the public, the best way to achieve this is to make it | ||
| 625 | free software which everyone can redistribute and change under these terms. | ||
| 626 | |||
| 627 | To do so, attach the following notices to the program. It is safest | ||
| 628 | to attach them to the start of each source file to most effectively | ||
| 629 | state the exclusion of warranty; and each file should have at least | ||
| 630 | the "copyright" line and a pointer to where the full notice is found. | ||
| 631 | |||
| 632 | <one line to give the program's name and a brief idea of what it does.> | ||
| 633 | Copyright (C) <year> <name of author> | ||
| 634 | |||
| 635 | This program is free software: you can redistribute it and/or modify | ||
| 636 | it under the terms of the GNU General Public License as published by | ||
| 637 | the Free Software Foundation, either version 3 of the License, or | ||
| 638 | (at your option) any later version. | ||
| 639 | |||
| 640 | This program is distributed in the hope that it will be useful, | ||
| 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 643 | GNU General Public License for more details. | ||
| 644 | |||
| 645 | You should have received a copy of the GNU General Public License | ||
| 646 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 647 | |||
| 648 | Also add information on how to contact you by electronic and paper mail. | ||
| 649 | |||
| 650 | If the program does terminal interaction, make it output a short | ||
| 651 | notice like this when it starts in an interactive mode: | ||
| 652 | |||
| 653 | <program> Copyright (C) <year> <name of author> | ||
| 654 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. | ||
| 655 | This is free software, and you are welcome to redistribute it | ||
| 656 | under certain conditions; type `show c' for details. | ||
| 657 | |||
| 658 | The hypothetical commands `show w' and `show c' should show the appropriate | ||
| 659 | parts of the General Public License. Of course, your program's commands | ||
| 660 | might be different; for a GUI interface, you would use an "about box". | ||
| 661 | |||
| 662 | You should also get your employer (if you work as a programmer) or school, | ||
| 663 | if any, to sign a "copyright disclaimer" for the program, if necessary. | ||
| 664 | For more information on this, and how to apply and follow the GNU GPL, see | ||
| 665 | <http://www.gnu.org/licenses/>. | ||
| 666 | |||
| 667 | The GNU General Public License does not permit incorporating your program | ||
| 668 | into proprietary programs. If your program is a subroutine library, you | ||
| 669 | may consider it more useful to permit linking proprietary applications with | ||
| 670 | the library. If this is what you want to do, use the GNU Lesser General | ||
| 671 | Public License instead of this License. But first, please read | ||
| 672 | <http://www.gnu.org/philosophy/why-not-lgpl.html>. | ||
| @@ -0,0 +1,25 @@ | |||
| 1 | utouch-frame - Touch Frame Library | ||
| 2 | |||
| 3 | To build, you need to have the autoconf, libtool, libutouch-evemu-dev | ||
| 4 | and mtdev-dev packages installed. Then, do | ||
| 5 | |||
| 6 | ./autogen.sh | ||
| 7 | ./configure | ||
| 8 | make | ||
| 9 | |||
| 10 | To test the touch properties of an MT device at /dev/input/eventX, do | ||
| 11 | |||
| 12 | sudo ./test/utouch-frame-test /dev/input/eventX | ||
| 13 | |||
| 14 | You should be able to see touch events in the terminal. After five | ||
| 15 | seconds of inactivity, the program exits. | ||
| 16 | |||
| 17 | To install utouch-frame, do | ||
| 18 | |||
| 19 | sudo make install | ||
| 20 | |||
| 21 | By default, utouch-frame installs to /usr/local. To change, use the --prefix | ||
| 22 | configure option. | ||
| 23 | |||
| 24 | Enjoy, | ||
| 25 | Henrik | ||
diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..6a94173 --- /dev/null +++ b/Makefile.am | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | SUBDIRS = src tools test | ||
| 2 | |||
| 3 | pkgconfigdir = $(libdir)/pkgconfig | ||
| 4 | pkgconfig_DATA = utouch-frame.pc | ||
| 5 | |||
| 6 | INCLUDES = $(top_srcdir)/include/ | ||
| 7 | |||
| 8 | .PHONY: ChangeLog INSTALL | ||
| 9 | INSTALL: | ||
| 10 | $(INSTALL_CMD) | ||
| 11 | ChangeLog: | ||
| 12 | bzr log > ChangeLog | ||
| 13 | |||
| 14 | dist-hook: ChangeLog INSTALL | ||
| @@ -0,0 +1,7 @@ | |||
| 1 | utouch-frame - Touch Frame Library | ||
| 2 | |||
| 3 | This tree handles the buildup and synchronization of a set of | ||
| 4 | simultaneous touches. The library is input agnostic. | ||
| 5 | |||
| 6 | Enjoy, | ||
| 7 | Henrik | ||
diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..a08311b --- /dev/null +++ b/autogen.sh | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | #! /bin/sh | ||
| 2 | |||
| 3 | srcdir=`dirname $0` | ||
| 4 | test -z "$srcdir" && srcdir=. | ||
| 5 | |||
| 6 | ORIGDIR=`pwd` | ||
| 7 | cd $srcdir | ||
| 8 | |||
| 9 | autoreconf -v --install || exit 1 | ||
| 10 | cd $ORIGDIR || exit $? | ||
| 11 | |||
diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..0ff758f --- /dev/null +++ b/configure.ac | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | # Initialize Autoconf | ||
| 2 | AC_PREREQ([2.60]) | ||
| 3 | AC_INIT([Touch Frame Library], | ||
| 4 | [1.0.0], | ||
| 5 | [], | ||
| 6 | [utouch-frame]) | ||
| 7 | AC_CONFIG_SRCDIR([Makefile.am]) | ||
| 8 | AC_CONFIG_HEADERS([config.h]) | ||
| 9 | AC_CONFIG_AUX_DIR([config-aux]) | ||
| 10 | |||
| 11 | # Initialize Automake | ||
| 12 | AM_INIT_AUTOMAKE([foreign dist-bzip2]) | ||
| 13 | AM_MAINTAINER_MODE | ||
| 14 | |||
| 15 | LIB_VERSION=1:0:0 | ||
| 16 | AC_SUBST([LIB_VERSION]) | ||
| 17 | |||
| 18 | # Initialize libtool | ||
| 19 | AC_PROG_LIBTOOL | ||
| 20 | |||
| 21 | # Checks for programs. | ||
| 22 | AC_PROG_CC | ||
| 23 | AC_PROG_INSTALL | ||
| 24 | |||
| 25 | PKG_CHECK_MODULES([MTDEV], [mtdev >= 1.1]) | ||
| 26 | PKG_CHECK_MODULES([EVEMU], [utouch-evemu >= 1.0]) | ||
| 27 | |||
| 28 | AC_CONFIG_FILES([Makefile | ||
| 29 | src/Makefile | ||
| 30 | test/Makefile | ||
| 31 | tools/Makefile | ||
| 32 | utouch-frame.pc]) | ||
| 33 | AC_OUTPUT | ||
diff --git a/docs/event-semantics.txt b/docs/event-semantics.txt new file mode 100644 index 0000000..87afe4e --- /dev/null +++ b/docs/event-semantics.txt | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | FRAME | ||
| 2 | |||
| 3 | The touch frame, consisting of a set of simultaneous contacts. | ||
| 4 | |||
| 5 | CONTACT | ||
| 6 | |||
| 7 | The current MT contact configuration. Changes whenever an id changes. | ||
| 8 | |||
| 9 | TOUCH | ||
| 10 | |||
| 11 | The current touch configuration. Changes whenever the number of contacts | ||
| 12 | changes. A touch frame is well-defined a time T after the last | ||
| 13 | configuration change. This allows for simultaneous touches being | ||
| 14 | handled. It also allows for a very quick change of one finger to | ||
| 15 | another. Such an action changes the CONTACT state, but it does not change | ||
| 16 | the TOUCH state. | ||
| 17 | |||
| 18 | DRAG/PINCH/ROTATE | ||
| 19 | |||
| 20 | A transformation based on the touch frame. | ||
| 21 | |||
| 22 | GESTURES | ||
| 23 | |||
| 24 | Two creation points may be grouped if they are close in space-time, and | ||
| 25 | they are always close within the same controlling entity. There can be only | ||
| 26 | one controlling entity per point, and that decision is made upon | ||
| 27 | creation. The window manager is a controlling entity. Ambiguities can occur | ||
| 28 | between close points, and are resolved either by state rule or by | ||
| 29 | priority. Relaxing the time closeness criteria has no effect within a | ||
| 30 | controlling entity, but creates a larger set of ambiguous and undesired | ||
| 31 | groupings, which is considered inferior. | ||
diff --git a/include/utouch/frame-mtdev.h b/include/utouch/frame-mtdev.h new file mode 100644 index 0000000..f3957b9 --- /dev/null +++ b/include/utouch/frame-mtdev.h | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | /***************************************************************************** | ||
| 2 | * | ||
| 3 | * utouch-frame - Touch Frame Library | ||
| 4 | * | ||
| 5 | * Copyright (C) 2010-2011 Canonical Ltd. | ||
| 6 | * | ||
| 7 | * This program is free software: you can redistribute it and/or modify it | ||
| 8 | * under the terms of the GNU General Public License as published by the | ||
| 9 | * Free Software Foundation, either version 3 of the License, or (at your | ||
| 10 | * option) any later version. | ||
| 11 | * | ||
| 12 | * This program is distributed in the hope that it will be useful, but | ||
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 15 | * General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License along | ||
| 18 | * with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 19 | * | ||
| 20 | ****************************************************************************/ | ||
| 21 | |||
| 22 | #ifndef _UTOUCH_FRAME_MTDEV_H | ||
| 23 | #define _UTOUCH_FRAME_MTDEV_H | ||
| 24 | |||
| 25 | #define MTDEV_NO_LEGACY_API | ||
| 26 | |||
| 27 | #include <utouch/frame.h> | ||
| 28 | #include <evemu.h> | ||
| 29 | #include <mtdev.h> | ||
| 30 | |||
| 31 | int utouch_frame_is_supported_mtdev(const struct evemu_device *dev); | ||
| 32 | |||
| 33 | int utouch_frame_init_mtdev(utouch_frame_handle fh, | ||
| 34 | const struct evemu_device *dev); | ||
| 35 | |||
| 36 | const struct utouch_frame * | ||
| 37 | utouch_frame_pump_mtdev(utouch_frame_handle fh, const struct input_event *ev); | ||
| 38 | |||
| 39 | #endif | ||
diff --git a/include/utouch/frame.h b/include/utouch/frame.h new file mode 100644 index 0000000..08e4e26 --- /dev/null +++ b/include/utouch/frame.h | |||
| @@ -0,0 +1,250 @@ | |||
| 1 | /***************************************************************************** | ||
| 2 | * | ||
| 3 | * utouch-frame - Touch Frame Library | ||
| 4 | * | ||
| 5 | * Copyright (C) 2010-2011 Canonical Ltd. | ||
| 6 | * | ||
| 7 | * This program is free software: you can redistribute it and/or modify it | ||
| 8 | * under the terms of the GNU General Public License as published by the | ||
| 9 | * Free Software Foundation, either version 3 of the License, or (at your | ||
| 10 | * option) any later version. | ||
| 11 | * | ||
| 12 | * This program is distributed in the hope that it will be useful, but | ||
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 15 | * General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License along | ||
| 18 | * with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 19 | * | ||
| 20 | ****************************************************************************/ | ||
| 21 | |||
| 22 | #ifndef _UTOUCH_FRAME_H | ||
| 23 | #define _UTOUCH_FRAME_H | ||
| 24 | |||
| 25 | #include <stdint.h> | ||
| 26 | |||
| 27 | #define UTOUCH_FRAME_VERSION 0x00001000 | ||
| 28 | |||
| 29 | /** | ||
| 30 | * struct utouch_surface - device surface details | ||
| 31 | * @needs_pointer: device needs a screen pointer to function | ||
| 32 | * @is_direct: surface is a direct device (e.g. touchscreen) | ||
| 33 | * @is_buttonpad: surface has button(s) under it | ||
| 34 | * @is_semi_mt: surface detects bounding rectangle only | ||
| 35 | * @use_touch_major: device uses major axis for contact modulation | ||
| 36 | * @use_touch_minor: device uses minor axis for contact modulation | ||
| 37 | * @use_width_major: device uses approaching major axis for contact modulation | ||
| 38 | * @use_width_minor: device uses approaching minor axis for contact modulation | ||
| 39 | * @use_orientation: device uses ellipse orientation for contact modulation | ||
| 40 | * @use_pressure: device uses pressure for contact modulation | ||
| 41 | * @use_distance: device uses hover distance | ||
| 42 | * @phys_width: physical width in millimeters (mm) | ||
| 43 | * @phys_height: physical height in millimeters (mm) | ||
| 44 | * @phys_pressure: maximal physical pressure (N/cm^2) | ||
| 45 | * @min_x: minimum horizontal coordinate value | ||
| 46 | * @min_y: minimum vertical coordinate value | ||
| 47 | * @max_x: maximum horizontal coordinate value | ||
| 48 | * @max_y: maximum vertical coordinate value | ||
| 49 | * @max_pressure: maximum pressure coordinate value | ||
| 50 | * | ||
| 51 | * Device properties and touch surface details. Later versions of this | ||
| 52 | * struct may grow in size, but will remain binary compatible with | ||
| 53 | * older versions. | ||
| 54 | */ | ||
| 55 | struct utouch_surface { | ||
| 56 | int needs_pointer; | ||
| 57 | int is_direct; | ||
| 58 | int is_buttonpad; | ||
| 59 | int is_semi_mt; | ||
| 60 | int use_touch_major; | ||
| 61 | int use_touch_minor; | ||
| 62 | int use_width_major; | ||
| 63 | int use_width_minor; | ||
| 64 | int use_orientation; | ||
| 65 | int use_pressure; | ||
| 66 | int use_distance; | ||
| 67 | float phys_width; | ||
| 68 | float phys_height; | ||
| 69 | float phys_pressure; | ||
| 70 | float min_x; | ||
| 71 | float min_y; | ||
| 72 | float max_x; | ||
| 73 | float max_y; | ||
| 74 | float max_pressure; | ||
| 75 | }; | ||
| 76 | |||
| 77 | #define UTOUCH_TOOL_FINGER 0 | ||
| 78 | #define UTOUCH_TOOL_PEN 1 | ||
| 79 | |||
| 80 | /** | ||
| 81 | * struct utouch_contact - surface contact details | ||
| 82 | * @prev: pointer to same slot of previous frame | ||
| 83 | * @active: currently in use | ||
| 84 | * @slot: slot occupied by this contact | ||
| 85 | * @id: unique id of this contact | ||
| 86 | * @tool_type: the tool type of this contact | ||
| 87 | * @x: horizontal center position coordinate (surface units) | ||
| 88 | * @y: vertical center position coordinate (surface units) | ||
| 89 | * @touch_major: major axis of contact (surface units) | ||
| 90 | * @touch_minor: minor axis of contact (surface units) | ||
| 91 | * @width_major: major axis of approaching contact (surface units) | ||
| 92 | * @width_minor: minor axis of approaching contact (surface units) | ||
| 93 | * @orientation: direction of ellipse (left: -Pi/2, up: 0, right: Pi/2) | ||
| 94 | * @pressure: pressure of contact (pressure units) | ||
| 95 | * @distance: distance of contact (surface units) | ||
| 96 | * | ||
| 97 | * Surface contact details. Later versions of this struct may grow in | ||
| 98 | * size, but will remain binary compatible with older versions. | ||
| 99 | * | ||
| 100 | * Contact structures are connected into one ring per slot. The | ||
| 101 | * previous contact pointers are ABI agnostic, owned by the engine, | ||
| 102 | * and have engine scope. | ||
| 103 | */ | ||
| 104 | struct utouch_contact { | ||
| 105 | const struct utouch_contact *prev; | ||
| 106 | int active; | ||
| 107 | int slot; | ||
| 108 | int id; | ||
| 109 | int tool_type; | ||
| 110 | float x; | ||
| 111 | float y; | ||
| 112 | float touch_major; | ||
| 113 | float touch_minor; | ||
| 114 | float width_major; | ||
| 115 | float width_minor; | ||
| 116 | float orientation; | ||
| 117 | float pressure; | ||
| 118 | float distance; | ||
| 119 | }; | ||
| 120 | |||
| 121 | /* time in milliseconds */ | ||
| 122 | typedef uint64_t utouch_frame_time_t; | ||
| 123 | |||
| 124 | /* the frame engine handle */ | ||
| 125 | typedef struct utouch_frame_engine *utouch_frame_handle; | ||
| 126 | |||
| 127 | /** | ||
| 128 | * struct utouch_frame - emitted frame details | ||
| 129 | * @prev: pointer to previous frame | ||
| 130 | * @sequence_id: frame sequence number | ||
| 131 | * @revision: changes whenever the contact count changes | ||
| 132 | * @slot_revision: changes whenever the slot id array change | ||
| 133 | * @num_active: the number of contacts in the active array | ||
| 134 | * @time: time of frame completion (ms) | ||
| 135 | * @mod_time: time of last contact count change (ms) | ||
| 136 | * @slot_mod_time: time of last slot id array change (ms) | ||
| 137 | * @active: the array of active contacts | ||
| 138 | * | ||
| 139 | * Contact frame details. Later versions of this struct may grow in | ||
| 140 | * size, but will remain binary compatible with older versions. | ||
| 141 | * | ||
| 142 | * Frames are connected into a ring. The previous frame pointer is ABI | ||
| 143 | * agnostic, owned by the engine, and has engine scope. | ||
| 144 | */ | ||
| 145 | struct utouch_frame { | ||
| 146 | const struct utouch_frame *prev; | ||
| 147 | unsigned int sequence_id; | ||
| 148 | unsigned int revision; | ||
| 149 | unsigned int slot_revision; | ||
| 150 | unsigned int num_active; | ||
| 151 | utouch_frame_time_t time; | ||
| 152 | utouch_frame_time_t mod_time; | ||
| 153 | utouch_frame_time_t slot_mod_time; | ||
| 154 | struct utouch_contact **active; | ||
| 155 | struct utouch_contact **slots; | ||
| 156 | }; | ||
| 157 | |||
| 158 | /** | ||
| 159 | * utouch_frame_get_version - get library abi version | ||
| 160 | * | ||
| 161 | * Returns the version of the library, which may be different | ||
| 162 | * from the api version of the compiled user program. | ||
| 163 | */ | ||
| 164 | unsigned int utouch_frame_get_version(void); | ||
| 165 | |||
| 166 | utouch_frame_handle utouch_frame_new_engine_raw(unsigned int num_frames, | ||
| 167 | unsigned int num_slots, | ||
| 168 | unsigned int frame_rate, | ||
| 169 | unsigned int version, | ||
| 170 | unsigned int surface_size, | ||
| 171 | unsigned int frame_size, | ||
| 172 | unsigned int slot_size); | ||
| 173 | |||
| 174 | /** | ||
| 175 | * utouch_frame_new_engine - allocate a new frame engine | ||
| 176 | * @num_frames: number of frames in cyclic buffer | ||
| 177 | * @num_slots: maximum number of slots per frame | ||
| 178 | * @frame_rate: maximum frame rate (frames/s) | ||
| 179 | * | ||
| 180 | * Allocates memory, initializes the internal engine and returns a | ||
| 181 | * handle to it. A rate of 100 frames per second is normal. | ||
| 182 | */ | ||
| 183 | #define utouch_frame_new_engine(num_frames, num_slots, frame_rate) \ | ||
| 184 | utouch_frame_new_engine_raw(num_frames, \ | ||
| 185 | num_slots, \ | ||
| 186 | frame_rate, \ | ||
| 187 | UTOUCH_FRAME_VERSION, \ | ||
| 188 | sizeof(struct utouch_surface), \ | ||
| 189 | sizeof(struct utouch_frame), \ | ||
| 190 | sizeof(struct utouch_contact)) | ||
| 191 | |||
| 192 | /** | ||
| 193 | * utouch_frame_delete_engine - deallocate a frame engine | ||
| 194 | * @fh: frame engine in use | ||
| 195 | * | ||
| 196 | * Deallocates all memory associated with the engine. | ||
| 197 | */ | ||
| 198 | void utouch_frame_delete_engine(utouch_frame_handle fh); | ||
| 199 | |||
| 200 | /** | ||
| 201 | * utouch_frame_get_surface - get the mutable device surface information | ||
| 202 | * @fh: the frame engine in use | ||
| 203 | * | ||
| 204 | * Returns a pointer to the mutable device surface information. It is | ||
| 205 | * preferrably set up by one of the input handlers. The pointer is ABI | ||
| 206 | * agnostic, has frame engine scope, and is owned by the engine. | ||
| 207 | */ | ||
| 208 | struct utouch_surface *utouch_frame_get_surface(utouch_frame_handle fh); | ||
| 209 | |||
| 210 | /** | ||
| 211 | * utouch_frame_get_current_slot - get the current mutable slot contact | ||
| 212 | * @fh: the frame engine in use | ||
| 213 | * | ||
| 214 | * Returns a pointer to the contact current being modified. The | ||
| 215 | * pointer is ABI agnostic, has frame engine scope, and is owned by | ||
| 216 | * the engine. | ||
| 217 | */ | ||
| 218 | struct utouch_contact *utouch_frame_get_current_slot(utouch_frame_handle fh); | ||
| 219 | |||
| 220 | /** | ||
| 221 | * utouch_frame_set_current_slot - set the current slot number | ||
| 222 | * @fh: the frame engine in use | ||
| 223 | * @slot: the slot number | ||
| 224 | * | ||
| 225 | * Sets the slot currently being modified. Returns zero if successful, | ||
| 226 | * negative error otherwise. | ||
| 227 | */ | ||
| 228 | int utouch_frame_set_current_slot(utouch_frame_handle fh, int slot); | ||
| 229 | |||
| 230 | /** | ||
| 231 | * utouch_frame_sync - synchronize and return new frame | ||
| 232 | * @fh: the frame engine in use | ||
| 233 | * @time: the frame synchronization time (ms) | ||
| 234 | * | ||
| 235 | * Scans through the updates, and in case the changes make up a new | ||
| 236 | * frame, returns the updated frame. | ||
| 237 | * | ||
| 238 | * If time is zero, a time-of-receipt will be used instead. | ||
| 239 | * | ||
| 240 | * The frame returned is always the next in the cyclic list, and | ||
| 241 | * always points back at the previous frame returned by this function. | ||
| 242 | * | ||
| 243 | * The returned pointer is ABI agnostic and owned by the frame | ||
| 244 | * engine. It may very well be zero if there is nothing to report or | ||
| 245 | * if the frame rate is limited. | ||
| 246 | */ | ||
| 247 | const struct utouch_frame *utouch_frame_sync(utouch_frame_handle fh, | ||
| 248 | utouch_frame_time_t time); | ||
| 249 | |||
| 250 | #endif | ||
diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..aa11733 --- /dev/null +++ b/src/Makefile.am | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | lib_LTLIBRARIES = libutouch-frame.la | ||
| 2 | |||
| 3 | libutouch_frame_la_LDFLAGS = \ | ||
| 4 | -version-info @LIB_VERSION@ \ | ||
| 5 | -lm \ | ||
| 6 | $(EVEMU_LIBS) | ||
| 7 | $(MTDEV_LIBS) | ||
| 8 | |||
| 9 | libutouch_frame_la_SOURCES = \ | ||
| 10 | frame-impl.h \ | ||
| 11 | frame.c \ | ||
| 12 | frame-mtdev.c | ||
| 13 | |||
| 14 | AM_CFLAGS = $(CWARNFLAGS) | ||
| 15 | |||
| 16 | INCLUDES = -I$(top_srcdir)/include/ | ||
| 17 | |||
| 18 | libutouch_frameincludedir = $(includedir)/utouch | ||
| 19 | libutouch_frameinclude_HEADERS = \ | ||
| 20 | $(top_srcdir)/include/utouch/frame.h \ | ||
| 21 | $(top_srcdir)/include/utouch/frame-mtdev.h | ||
diff --git a/src/frame-impl.h b/src/frame-impl.h new file mode 100644 index 0000000..c31f7da --- /dev/null +++ b/src/frame-impl.h | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | #ifndef _FRAME_IMPL_H | ||
| 2 | #define _FRAME_IMPL_H | ||
| 3 | |||
| 4 | #include <utouch/frame.h> | ||
| 5 | |||
| 6 | struct utouch_frame_engine { | ||
| 7 | int num_frames; | ||
| 8 | int num_slots; | ||
| 9 | int hold_ms; | ||
| 10 | int frame; | ||
| 11 | int slot; | ||
| 12 | float max_orient; | ||
| 13 | struct utouch_surface *surface; | ||
| 14 | struct utouch_frame **frames; | ||
| 15 | struct utouch_frame *next; | ||
| 16 | }; | ||
| 17 | |||
| 18 | #endif | ||
diff --git a/src/frame-mtdev.c b/src/frame-mtdev.c new file mode 100644 index 0000000..ed5dc9e --- /dev/null +++ b/src/frame-mtdev.c | |||
| @@ -0,0 +1,189 @@ | |||
| 1 | /***************************************************************************** | ||
| 2 | * | ||
| 3 | * utouch-frame - Touch Frame Library | ||
| 4 | * | ||
| 5 | * Copyright (C) 2010 Canonical Ltd. | ||
| 6 | * | ||
| 7 | * This program is free software: you can redistribute it and/or modify it | ||
| 8 | * under the terms of the GNU General Public License as published by the | ||
| 9 | * Free Software Foundation, either version 3 of the License, or (at your | ||
| 10 | * option) any later version. | ||
| 11 | * | ||
| 12 | * This program is distributed in the hope that it will be useful, but | ||
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 15 | * General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License along | ||
| 18 | * with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 19 | * | ||
| 20 | ****************************************************************************/ | ||
| 21 | |||
| 22 | #include <utouch/frame-mtdev.h> | ||
| 23 | #include "frame-impl.h" | ||
| 24 | #include <linux/input.h> | ||
| 25 | #include <errno.h> | ||
| 26 | #include <math.h> | ||
| 27 | |||
| 28 | int utouch_frame_is_supported_mtdev(const struct evemu_device *dev) | ||
| 29 | { | ||
| 30 | |||
| 31 | /* only support pure absolute devices at this time */ | ||
| 32 | if (evemu_has_event(dev, EV_REL, REL_X) || | ||
| 33 | evemu_has_event(dev, EV_REL, REL_Y)) | ||
| 34 | return 0; | ||
| 35 | |||
| 36 | if (evemu_has_event(dev, EV_ABS, ABS_MT_POSITION_X) && | ||
| 37 | evemu_has_event(dev, EV_ABS, ABS_MT_POSITION_Y)) | ||
| 38 | return 1; | ||
| 39 | |||
| 40 | return evemu_has_event(dev, EV_ABS, ABS_X) && | ||
| 41 | evemu_has_event(dev, EV_ABS, ABS_Y) && | ||
| 42 | evemu_has_event(dev, EV_KEY, BTN_TOUCH) && | ||
| 43 | evemu_has_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP); | ||
| 44 | } | ||
| 45 | |||
| 46 | int utouch_frame_init_mtdev(utouch_frame_handle fh, | ||
| 47 | const struct evemu_device *dev) | ||
| 48 | { | ||
| 49 | struct utouch_surface *s = fh->surface; | ||
| 50 | float tmp; | ||
| 51 | |||
| 52 | if (!utouch_frame_is_supported_mtdev(dev)) | ||
| 53 | return -ENODEV; | ||
| 54 | |||
| 55 | #ifdef INPUT_PROP_POINTER | ||
| 56 | s->needs_pointer = evemu_has_prop(dev, INPUT_PROP_POINTER); | ||
| 57 | s->is_direct = evemu_has_prop(dev, INPUT_PROP_DIRECT); | ||
| 58 | s->is_buttonpad = evemu_has_prop(dev, INPUT_PROP_BUTTONPAD); | ||
| 59 | s->is_semi_mt = evemu_has_prop(dev, INPUT_PROP_SEMI_MT); | ||
| 60 | #endif | ||
| 61 | s->use_touch_major = evemu_has_event(dev, EV_ABS, ABS_MT_TOUCH_MAJOR); | ||
| 62 | s->use_touch_minor = evemu_has_event(dev, EV_ABS, ABS_MT_TOUCH_MINOR); | ||
| 63 | s->use_width_major = evemu_has_event(dev, EV_ABS, ABS_MT_WIDTH_MAJOR); | ||
| 64 | s->use_width_minor = evemu_has_event(dev, EV_ABS, ABS_MT_WIDTH_MINOR); | ||
| 65 | s->use_orientation = evemu_has_event(dev, EV_ABS, ABS_MT_ORIENTATION); | ||
| 66 | s->use_pressure = evemu_has_event(dev, EV_ABS, ABS_MT_PRESSURE); | ||
| 67 | #ifdef ABS_MT_DISTANCE | ||
| 68 | s->use_distance = evemu_has_event(dev, EV_ABS, ABS_MT_DISTANCE); | ||
| 69 | #endif | ||
| 70 | |||
| 71 | |||
| 72 | s->min_x = evemu_get_abs_minimum(dev, ABS_MT_POSITION_X); | ||
| 73 | s->min_y = evemu_get_abs_minimum(dev, ABS_MT_POSITION_Y); | ||
| 74 | s->max_x = evemu_get_abs_maximum(dev, ABS_MT_POSITION_X); | ||
| 75 | s->max_y = evemu_get_abs_maximum(dev, ABS_MT_POSITION_Y); | ||
| 76 | if (s->min_x == s->max_x) { | ||
| 77 | s->min_x = 0; | ||
| 78 | s->max_x = 1024; | ||
| 79 | } | ||
| 80 | if (s->min_y == s->max_y) { | ||
| 81 | s->min_y = 0; | ||
| 82 | s->max_y = 768; | ||
| 83 | } | ||
| 84 | |||
| 85 | s->max_pressure = evemu_get_abs_maximum(dev, ABS_MT_PRESSURE); | ||
| 86 | if (s->use_pressure && s->max_pressure == 0) | ||
| 87 | s->max_pressure = 256; | ||
| 88 | |||
| 89 | fh->max_orient = evemu_get_abs_maximum(dev, ABS_MT_ORIENTATION); | ||
| 90 | if (s->use_orientation && fh->max_orient == 0) | ||
| 91 | fh->max_orient = 1; | ||
| 92 | |||
| 93 | tmp = evemu_get_abs_resolution(dev, ABS_MT_POSITION_X); | ||
| 94 | if (tmp > 0) | ||
| 95 | s->phys_width = (s->max_x - s->min_x) / tmp; | ||
| 96 | else if (s->needs_pointer) | ||
| 97 | s->phys_width = 100; | ||
| 98 | else | ||
| 99 | s->phys_width = 250; | ||
| 100 | |||
| 101 | tmp = evemu_get_abs_resolution(dev, ABS_MT_POSITION_Y); | ||
| 102 | if (tmp > 0) | ||
| 103 | s->phys_height = (s->max_y - s->min_y) / tmp; | ||
| 104 | else if (s->needs_pointer) | ||
| 105 | s->phys_height = 65; | ||
| 106 | else | ||
| 107 | s->phys_height = 160; | ||
| 108 | |||
| 109 | tmp = evemu_get_abs_resolution(dev, ABS_MT_PRESSURE); | ||
| 110 | if (tmp > 0) | ||
| 111 | s->phys_pressure = s->max_pressure / tmp; | ||
| 112 | else | ||
| 113 | s->phys_pressure = 10; | ||
| 114 | |||
| 115 | return 0; | ||
| 116 | } | ||
| 117 | |||
| 118 | static float touch_angle(utouch_frame_handle fh, int orient) | ||
| 119 | { | ||
| 120 | return orient / fh->max_orient * M_PI_2; | ||
| 121 | } | ||
| 122 | |||
| 123 | static int handle_abs_event(utouch_frame_handle fh, | ||
| 124 | const struct input_event *ev) | ||
| 125 | { | ||
| 126 | struct utouch_contact *t = utouch_frame_get_current_slot(fh); | ||
| 127 | |||
| 128 | switch (ev->code) { | ||
| 129 | case ABS_MT_SLOT: | ||
| 130 | utouch_frame_set_current_slot(fh, ev->value); | ||
| 131 | return 1; | ||
| 132 | case ABS_MT_POSITION_X: | ||
| 133 | t->x = ev->value; | ||
| 134 | return 1; | ||
| 135 | case ABS_MT_POSITION_Y: | ||
| 136 | t->y = ev->value; | ||
| 137 | return 1; | ||
| 138 | case ABS_MT_TOUCH_MAJOR: | ||
| 139 | t->touch_major = ev->value; | ||
| 140 | return 1; | ||
| 141 | case ABS_MT_TOUCH_MINOR: | ||
| 142 | t->touch_minor = ev->value; | ||
| 143 | return 1; | ||
| 144 | case ABS_MT_WIDTH_MAJOR: | ||
| 145 | t->width_major = ev->value; | ||
| 146 | return 1; | ||
| 147 | case ABS_MT_WIDTH_MINOR: | ||
| 148 | t->width_minor = ev->value; | ||
| 149 | return 1; | ||
| 150 | case ABS_MT_ORIENTATION: | ||
| 151 | t->orientation = touch_angle(fh, ev->value); | ||
| 152 | return 1; | ||
| 153 | case ABS_MT_PRESSURE: | ||
| 154 | t->pressure = ev->value; | ||
| 155 | return 1; | ||
| 156 | #ifdef ABS_MT_DISTANCE | ||
| 157 | case ABS_MT_DISTANCE: | ||
| 158 | t->distance = ev->value; | ||
| 159 | return 1; | ||
| 160 | #endif | ||
| 161 | case ABS_MT_TOOL_TYPE: | ||
| 162 | t->tool_type = ev->value; | ||
| 163 | return 1; | ||
| 164 | case ABS_MT_TRACKING_ID: | ||
| 165 | t->id = ev->value; | ||
| 166 | return 1; | ||
| 167 | default: | ||
| 168 | return 0; | ||
| 169 | } | ||
| 170 | } | ||
| 171 | |||
| 172 | static utouch_frame_time_t get_evtime_ms(const struct input_event *syn) | ||
| 173 | { | ||
| 174 | static const utouch_frame_time_t ms = 1000; | ||
| 175 | return syn->time.tv_usec / ms + syn->time.tv_sec * ms; | ||
| 176 | } | ||
| 177 | |||
| 178 | const struct utouch_frame * | ||
| 179 | utouch_frame_pump_mtdev(utouch_frame_handle fh, const struct input_event *ev) | ||
| 180 | { | ||
| 181 | const struct utouch_frame *f = 0; | ||
| 182 | |||
| 183 | if (ev->type == EV_SYN && ev->code == SYN_REPORT) | ||
| 184 | f = utouch_frame_sync(fh, get_evtime_ms(ev)); | ||
| 185 | else if (ev->type == EV_ABS) | ||
| 186 | handle_abs_event(fh, ev); | ||
| 187 | |||
| 188 | return f; | ||
| 189 | } | ||
diff --git a/src/frame.c b/src/frame.c new file mode 100644 index 0000000..9c4be97 --- /dev/null +++ b/src/frame.c | |||
| @@ -0,0 +1,303 @@ | |||
| 1 | /***************************************************************************** | ||
| 2 | * | ||
| 3 | * utouch-frame - Touch Frame Library | ||
| 4 | * | ||
| 5 | * Copyright (C) 2010 Canonical Ltd. | ||
| 6 | * | ||
| 7 | * This program is free software: you can redistribute it and/or modify it | ||
| 8 | * under the terms of the GNU General Public License as published by the | ||
| 9 | * Free Software Foundation, either version 3 of the License, or (at your | ||
| 10 | * option) any later version. | ||
| 11 | * | ||
| 12 | * This program is distributed in the hope that it will be useful, but | ||
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 15 | * General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License along | ||
| 18 | * with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 19 | * | ||
| 20 | ****************************************************************************/ | ||
| 21 | |||
| 22 | #include "frame-impl.h" | ||
| 23 | #include <errno.h> | ||
| 24 | #include <math.h> | ||
| 25 | #include <memory.h> | ||
| 26 | #include <stdlib.h> | ||
| 27 | #include <sys/time.h> | ||
| 28 | |||
| 29 | #define MAX(a, b) ((a) > (b) ? (a) : (b)) | ||
| 30 | |||
| 31 | unsigned int utouch_frame_get_version(void) | ||
| 32 | { | ||
| 33 | return UTOUCH_FRAME_VERSION; | ||
| 34 | } | ||
| 35 | |||
| 36 | static void destroy_slots(struct utouch_contact **slots, int nslot) | ||
| 37 | { | ||
| 38 | int i; | ||
| 39 | |||
| 40 | if (slots) { | ||
| 41 | for (i = nslot - 1; i >= 0; i--) | ||
| 42 | free(slots[i]); | ||
| 43 | free(slots); | ||
| 44 | } | ||
| 45 | } | ||
| 46 | |||
| 47 | static void destroy_frame(struct utouch_frame *frame, int nslot) | ||
| 48 | { | ||
| 49 | if (frame) { | ||
| 50 | destroy_slots(frame->slots, nslot); | ||
| 51 | free(frame->active); | ||
| 52 | free(frame); | ||
| 53 | } | ||
| 54 | } | ||
| 55 | |||
| 56 | static void destroy_frames(struct utouch_frame **frames, int nframe, int nslot) | ||
| 57 | { | ||
| 58 | int i; | ||
| 59 | |||
| 60 | if (frames) { | ||
| 61 | for (i = nframe - 1; i >= 0; i--) | ||
| 62 | destroy_frame(frames[i], nslot); | ||
| 63 | free(frames); | ||
| 64 | } | ||
| 65 | } | ||
| 66 | |||
| 67 | static struct utouch_contact **create_slots(int nslot, int size) | ||
| 68 | { | ||
| 69 | struct utouch_contact **slots; | ||
| 70 | struct utouch_contact *s; | ||
| 71 | int i; | ||
| 72 | |||
| 73 | slots = calloc(nslot, sizeof(slots[0])); | ||
| 74 | if (!slots) | ||
| 75 | return 0; | ||
| 76 | |||
| 77 | for (i = 0; i < nslot; i++) { | ||
| 78 | s = calloc(1, size); | ||
| 79 | if (!s) | ||
| 80 | goto out; | ||
| 81 | slots[i] = s; | ||
| 82 | s->slot = i; | ||
| 83 | s->id = -1; | ||
| 84 | } | ||
| 85 | |||
| 86 | return slots; | ||
| 87 | out: | ||
| 88 | destroy_slots(slots, nslot); | ||
| 89 | return 0; | ||
| 90 | } | ||
| 91 | |||
| 92 | static struct utouch_frame *create_frame(int nslot, | ||
| 93 | int frame_size, int slot_size) | ||
| 94 | { | ||
| 95 | struct utouch_frame *frame; | ||
| 96 | int i; | ||
| 97 | |||
| 98 | frame = calloc(1, frame_size); | ||
| 99 | if (!frame) | ||
| 100 | return 0; | ||
| 101 | |||
| 102 | frame->active = calloc(nslot, sizeof(frame->active[0])); | ||
| 103 | frame->slots = create_slots(nslot, slot_size); | ||
| 104 | if (!frame->active || !frame->slots) | ||
| 105 | goto out; | ||
| 106 | |||
| 107 | return frame; | ||
| 108 | out: | ||
| 109 | destroy_frame(frame, nslot); | ||
| 110 | return 0; | ||
| 111 | } | ||
| 112 | |||
| 113 | static struct utouch_frame **create_frames(int nframe, int nslot, | ||
| 114 | int frame_size, int slot_size) | ||
| 115 | { | ||
| 116 | struct utouch_frame **frames; | ||
| 117 | struct utouch_frame *f; | ||
| 118 | int i; | ||
| 119 | |||
| 120 | frames = calloc(nframe, sizeof(frames[0])); | ||
| 121 | if (!frames) | ||
| 122 | return 0; | ||
| 123 | |||
| 124 | for (i = 0; i < nframe; i++) { | ||
| 125 | f = create_frame(nslot, frame_size, slot_size); | ||
| 126 | if (!f) | ||
| 127 | goto out; | ||
| 128 | frames[i] = f; | ||
| 129 | } | ||
| 130 | |||
| 131 | return frames; | ||
| 132 | out: | ||
| 133 | destroy_frames(frames, nframe, nslot); | ||
| 134 | return 0; | ||
| 135 | } | ||
| 136 | |||
| 137 | utouch_frame_handle utouch_frame_new_engine_raw(unsigned int nframe, | ||
| 138 | unsigned int nslot, | ||
| 139 | unsigned int rate, | ||
| 140 | unsigned int version, | ||
| 141 | unsigned int surface_size, | ||
| 142 | unsigned int frame_size, | ||
| 143 | unsigned int slot_size) | ||
| 144 | { | ||
| 145 | struct utouch_frame *f, *pf; | ||
| 146 | utouch_frame_handle fh; | ||
| 147 | int i, j; | ||
| 148 | |||
| 149 | fh = calloc(1, sizeof(struct utouch_frame_engine)); | ||
| 150 | if (!fh) | ||
| 151 | return 0; | ||
| 152 | |||
| 153 | fh->num_frames = nframe; | ||
| 154 | fh->num_slots = nslot; | ||
| 155 | fh->hold_ms = 1000 / rate; | ||
| 156 | |||
| 157 | surface_size = MAX(surface_size, sizeof(struct utouch_surface)); | ||
| 158 | frame_size = MAX(frame_size, sizeof(struct utouch_frame)); | ||
| 159 | slot_size = MAX(slot_size, sizeof(struct utouch_contact)); | ||
| 160 | |||
| 161 | fh->surface = calloc(1, surface_size); | ||
| 162 | fh->frames = create_frames(nframe, nslot, frame_size, slot_size); | ||
| 163 | fh->next = create_frame(nslot, frame_size, slot_size); | ||
| 164 | if (!fh->surface || !fh->frames || !fh->next) | ||
| 165 | goto out; | ||
| 166 | |||
| 167 | pf = fh->frames[nframe - 1]; | ||
| 168 | for (i = 0; i < nframe; i++) { | ||
| 169 | f = fh->frames[i]; | ||
| 170 | for (j = 0; j < nslot; j++) | ||
| 171 | f->slots[j]->prev = pf->slots[j]; | ||
| 172 | f->prev = pf; | ||
| 173 | pf = f; | ||
| 174 | } | ||
| 175 | |||
| 176 | return fh; | ||
| 177 | out: | ||
| 178 | utouch_frame_delete_engine(fh); | ||
| 179 | return 0; | ||
| 180 | } | ||
| 181 | |||
| 182 | void utouch_frame_delete_engine(utouch_frame_handle fh) | ||
| 183 | { | ||
| 184 | destroy_frame(fh->next, fh->num_slots); | ||
| 185 | destroy_frames(fh->frames, fh->num_frames, fh->num_slots); | ||
| 186 | free(fh->surface); | ||
| 187 | free(fh); | ||
| 188 | } | ||
| 189 | |||
| 190 | struct utouch_surface *utouch_frame_get_surface(utouch_frame_handle fh) | ||
| 191 | { | ||
| 192 | return fh->surface; | ||
| 193 | } | ||
| 194 | |||
| 195 | struct utouch_contact *utouch_frame_get_current_slot(utouch_frame_handle fh) | ||
| 196 | { | ||
| 197 | return fh->next->slots[fh->slot]; | ||
| 198 | } | ||
| 199 | |||
| 200 | int utouch_frame_set_current_slot(utouch_frame_handle fh, int slot) | ||
| 201 | { | ||
| 202 | if (slot < 0 || slot >= fh->num_slots) | ||
| 203 | return -EINVAL; | ||
| 204 | fh->slot = slot; | ||
| 205 | return 0; | ||
| 206 | } | ||
| 207 | |||
| 208 | static void copy_contact(utouch_frame_handle fh, | ||
| 209 | struct utouch_contact *a, | ||
| 210 | const struct utouch_contact *b) | ||
| 211 | { | ||
| 212 | struct utouch_surface *s = fh->surface; | ||
| 213 | |||
| 214 | a->active = b->id != -1; | ||
| 215 | a->id = b->id; | ||
| 216 | a->tool_type = b->tool_type; | ||
| 217 | a->x = b->x; | ||
| 218 | a->y = b->y; | ||
| 219 | a->touch_major = b->touch_major; | ||
| 220 | a->touch_minor = s->use_touch_minor && b->touch_minor > 0 ? | ||
| 221 | b->touch_minor : b->touch_major; | ||
| 222 | a->width_major = b->width_major; | ||
| 223 | a->width_minor = s->use_width_minor && b->width_minor > 0 ? | ||
| 224 | b->width_minor : b->width_major; | ||
| 225 | a->orientation = b->orientation; | ||
| 226 | a->pressure = b->pressure; | ||
| 227 | a->distance = b->distance; | ||
| 228 | } | ||
| 229 | |||
| 230 | static int detect_addrem(const struct utouch_contact *a, | ||
| 231 | const struct utouch_contact *b) | ||
| 232 | { | ||
| 233 | return a->id != b->id || a->tool_type != b->tool_type; | ||
| 234 | } | ||
| 235 | |||
| 236 | static int detect_mod(const struct utouch_contact *a, | ||
| 237 | const struct utouch_contact *b) | ||
| 238 | { | ||
| 239 | return a->x != b->x || a->y != b->y || | ||
| 240 | a->touch_major != b->touch_major || | ||
| 241 | a->touch_minor != b->touch_minor || | ||
| 242 | a->width_major != b->width_major || | ||
| 243 | a->width_minor != b->width_minor || | ||
| 244 | a->orientation != b->orientation || | ||
| 245 | a->pressure != b->pressure || | ||
| 246 | a->distance != b->distance; | ||
| 247 | } | ||
| 248 | |||
| 249 | static utouch_frame_time_t get_time_ms() | ||
| 250 | { | ||
| 251 | static const utouch_frame_time_t ms = 1000; | ||
| 252 | struct timeval tv; | ||
| 253 | gettimeofday(&tv, 0); | ||
| 254 | return tv.tv_usec / ms + tv.tv_sec * ms; | ||
| 255 | } | ||
| 256 | |||
| 257 | const struct utouch_frame *utouch_frame_sync(utouch_frame_handle fh, | ||
| 258 | utouch_frame_time_t time) | ||
| 259 | { | ||
| 260 | struct utouch_frame *frame = fh->frames[fh->frame]; | ||
| 261 | const struct utouch_frame *prev = frame->prev; | ||
| 262 | struct utouch_frame *next = fh->next; | ||
| 263 | int naddrem = 0, nmod = 0; | ||
| 264 | int i; | ||
| 265 | |||
| 266 | frame->num_active = 0; | ||
| 267 | for (i = 0; i < fh->num_slots; i++) { | ||
| 268 | struct utouch_contact *p = frame->slots[i]; | ||
| 269 | const struct utouch_contact *q = next->slots[i]; | ||
| 270 | |||
| 271 | copy_contact(fh, p, q); | ||
| 272 | if (p->active) | ||
| 273 | frame->active[frame->num_active++] = p; | ||
| 274 | |||
| 275 | naddrem += detect_addrem(p->prev, p); | ||
| 276 | nmod += detect_mod(p->prev, p); | ||
| 277 | } | ||
| 278 | if (naddrem + nmod == 0) | ||
| 279 | return 0; | ||
| 280 | |||
| 281 | frame->time = time ? time : get_time_ms(); | ||
| 282 | if (naddrem == 0 && frame->time < prev->time + fh->hold_ms) | ||
| 283 | return 0; | ||
| 284 | |||
| 285 | if (frame->num_active != prev->num_active) { | ||
| 286 | next->mod_time = frame->time; | ||
| 287 | next->revision++; | ||
| 288 | } | ||
| 289 | if (naddrem) { | ||
| 290 | next->slot_mod_time = frame->time; | ||
| 291 | next->slot_revision++; | ||
| 292 | } | ||
| 293 | |||
| 294 | frame->revision = next->revision; | ||
| 295 | frame->slot_revision = next->slot_revision; | ||
| 296 | frame->mod_time = next->mod_time; | ||
| 297 | frame->slot_mod_time = next->slot_mod_time; | ||
| 298 | frame->sequence_id = next->sequence_id++; | ||
| 299 | |||
| 300 | fh->frame = (fh->frame + 1) % fh->num_frames; | ||
| 301 | |||
| 302 | return frame; | ||
| 303 | } | ||
diff --git a/test/Makefile.am b/test/Makefile.am new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Makefile.am | |||
diff --git a/tools/Makefile.am b/tools/Makefile.am new file mode 100644 index 0000000..6b50897 --- /dev/null +++ b/tools/Makefile.am | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | bin_PROGRAMS = utouch-frame-test-mtdev | ||
| 2 | |||
| 3 | INCLUDES=-I$(top_srcdir)/include/ | ||
| 4 | |||
| 5 | utouch_frame_test_mtdev_SOURCES = utouch-frame-test-mtdev.c | ||
| 6 | utouch_frame_test_mtdev_LDFLAGS = -L$(top_builddir)/src/.libs/ \ | ||
| 7 | -lutouch-frame -lutouch-evemu -lmtdev -lm | ||
diff --git a/tools/utouch-frame-test-mtdev.c b/tools/utouch-frame-test-mtdev.c new file mode 100644 index 0000000..13f5a68 --- /dev/null +++ b/tools/utouch-frame-test-mtdev.c | |||
| @@ -0,0 +1,202 @@ | |||
| 1 | /***************************************************************************** | ||
| 2 | * | ||
| 3 | * utouch-frame - Touch Frame Library | ||
| 4 | * | ||
| 5 | * Copyright (C) 2010-2011 Canonical Ltd. | ||
| 6 | * | ||
| 7 | * This program is free software: you can redistribute it and/or modify it | ||
| 8 | * under the terms of the GNU General Public License as published by the | ||
| 9 | * Free Software Foundation, either version 3 of the License, or (at your | ||
| 10 | * option) any later version. | ||
| 11 | * | ||
| 12 | * This program is distributed in the hope that it will be useful, but | ||
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 15 | * General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License along | ||
| 18 | * with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 19 | * | ||
| 20 | * Authors: | ||
| 21 | * Henrik Rydberg <rydberg@bitmath.org> | ||
| 22 | * | ||
| 23 | ****************************************************************************/ | ||
| 24 | |||
| 25 | #define MTDEV_NO_LEGACY_API | ||
| 26 | |||
| 27 | #include <utouch/frame-mtdev.h> | ||
| 28 | #include <mtdev.h> | ||
| 29 | #include <string.h> | ||
| 30 | #include <stdio.h> | ||
| 31 | #include <unistd.h> | ||
| 32 | #include <fcntl.h> | ||
| 33 | |||
| 34 | struct frame_test { | ||
| 35 | struct evemu_device *evemu; | ||
| 36 | struct mtdev *mtdev; | ||
| 37 | utouch_frame_handle fh; | ||
| 38 | }; | ||
| 39 | |||
| 40 | static int init_evemu(struct frame_test *test, int fd) | ||
| 41 | { | ||
| 42 | test->evemu = evemu_new(NULL); | ||
| 43 | if (!test->evemu) | ||
| 44 | return -1; | ||
| 45 | return evemu_extract(test->evemu, fd); | ||
| 46 | } | ||
| 47 | |||
| 48 | static int init_mtdev(struct frame_test *test, int fd) | ||
| 49 | { | ||
| 50 | test->mtdev = mtdev_new_open(fd); | ||
| 51 | if (!test->mtdev) | ||
| 52 | return -1; | ||
| 53 | return 0; | ||
| 54 | } | ||
| 55 | |||
| 56 | static int init_frame(struct frame_test *test, int fd) | ||
| 57 | { | ||
| 58 | test->fh = utouch_frame_new_engine(100, 32, 100); | ||
| 59 | if (!test->fh) | ||
| 60 | return -1; | ||
| 61 | return utouch_frame_init_mtdev(test->fh, test->evemu); | ||
| 62 | } | ||
| 63 | |||
| 64 | static void destroy_all(struct frame_test *test) | ||
| 65 | { | ||
| 66 | utouch_frame_delete_engine(test->fh); | ||
| 67 | mtdev_close_delete(test->mtdev); | ||
| 68 | evemu_delete(test->evemu); | ||
| 69 | memset(test, 0, sizeof(*test)); | ||
| 70 | } | ||
| 71 | |||
| 72 | static void report_frame(const struct utouch_frame *frame) | ||
| 73 | { | ||
| 74 | int i; | ||
| 75 | |||
| 76 | for (i = 0; i < frame->num_active; i++) { | ||
| 77 | const struct utouch_contact *t = frame->active[i]; | ||
| 78 | |||
| 79 | fprintf(stderr, "touch %d\n", i); | ||
| 80 | fprintf(stderr, " slot: %d\n", t->slot); | ||
| 81 | fprintf(stderr, " id: %d\n", t->id); | ||
| 82 | fprintf(stderr, " tool_type: %d\n", t->tool_type); | ||
| 83 | fprintf(stderr, " x: %f\n", t->x); | ||
| 84 | fprintf(stderr, " y: %f\n", t->y); | ||
| 85 | fprintf(stderr, " touch_major: %f\n", t->touch_major); | ||
| 86 | fprintf(stderr, " touch_minor: %f\n", t->touch_minor); | ||
| 87 | fprintf(stderr, " width_major: %f\n", t->width_major); | ||
| 88 | fprintf(stderr, " width_minor: %f\n", t->width_minor); | ||
| 89 | fprintf(stderr, " angle: %f\n", t->orientation); | ||
| 90 | fprintf(stderr, " pressure: %f\n", t->pressure); | ||
| 91 | fprintf(stderr, " distance: %f\n", t->distance); | ||
| 92 | } | ||
| 93 | |||
| 94 | fprintf(stderr, "sync %d %ld %d %d %d\n", | ||
| 95 | frame->num_active, | ||
| 96 | frame->time, | ||
| 97 | frame->sequence_id, | ||
| 98 | frame->revision, | ||
| 99 | frame->slot_revision); | ||
| 100 | } | ||
| 101 | |||
| 102 | static void loop_device(struct frame_test *test, int fd) | ||
| 103 | { | ||
| 104 | const struct utouch_frame *frame; | ||
| 105 | struct input_event ev; | ||
| 106 | |||
| 107 | while (!mtdev_idle(test->mtdev, fd, 5000)) { | ||
| 108 | while (mtdev_get(test->mtdev, fd, &ev, 1) > 0) { | ||
| 109 | frame = utouch_frame_pump_mtdev(test->fh, &ev); | ||
| 110 | if (frame) | ||
| 111 | report_frame(frame); | ||
| 112 | } | ||
| 113 | } | ||
| 114 | } | ||
| 115 | |||
| 116 | static void report_device_caps(struct frame_test *test) | ||
| 117 | { | ||
| 118 | #ifdef INPUT_PROP_POINTER | ||
| 119 | fprintf(stderr, "device props:\n"); | ||
| 120 | if (evemu_has_prop(test->evemu, INPUT_PROP_POINTER)) | ||
| 121 | fprintf(stderr, "\tpointer\n"); | ||
| 122 | if (evemu_has_prop(test->evemu, INPUT_PROP_DIRECT)) | ||
| 123 | fprintf(stderr, "\tdirect\n"); | ||
| 124 | if (evemu_has_prop(test->evemu, INPUT_PROP_BUTTONPAD)) | ||
| 125 | fprintf(stderr, "\tbuttonpad\n"); | ||
| 126 | if (evemu_has_prop(test->evemu, INPUT_PROP_SEMI_MT)) | ||
| 127 | fprintf(stderr, "\tsemi_mt\n"); | ||
| 128 | #endif | ||
| 129 | fprintf(stderr, "device mt events:\n"); | ||
| 130 | if (evemu_has_event(test->evemu, EV_ABS, ABS_MT_SLOT)) | ||
| 131 | fprintf(stderr, "\tslot\n"); | ||
| 132 | if (evemu_has_event(test->evemu, EV_ABS, ABS_MT_TOUCH_MAJOR)) | ||
| 133 | fprintf(stderr, "\ttouch_major\n"); | ||
| 134 | if (evemu_has_event(test->evemu, EV_ABS, ABS_MT_TOUCH_MINOR)) | ||
| 135 | fprintf(stderr, "\ttouch_minor\n"); | ||
| 136 | if (evemu_has_event(test->evemu, EV_ABS, ABS_MT_WIDTH_MAJOR)) | ||
| 137 | fprintf(stderr, "\twidth_major\n"); | ||
| 138 | if (evemu_has_event(test->evemu, EV_ABS, ABS_MT_WIDTH_MINOR)) | ||
| 139 | fprintf(stderr, "\twidth_minor\n"); | ||
| 140 | if (evemu_has_event(test->evemu, EV_ABS, ABS_MT_ORIENTATION)) | ||
| 141 | fprintf(stderr, "\torientation\n"); | ||
| 142 | if (evemu_has_event(test->evemu, EV_ABS, ABS_MT_POSITION_X)) | ||
| 143 | fprintf(stderr, "\tposition_x\n"); | ||
| 144 | if (evemu_has_event(test->evemu, EV_ABS, ABS_MT_POSITION_Y)) | ||
| 145 | fprintf(stderr, "\tposition_y\n"); | ||
| 146 | if (evemu_has_event(test->evemu, EV_ABS, ABS_MT_TOOL_TYPE)) | ||
| 147 | fprintf(stderr, "\tposition_y\n"); | ||
| 148 | if (evemu_has_event(test->evemu, EV_ABS, ABS_MT_TRACKING_ID)) | ||
| 149 | fprintf(stderr, "\ttracking_id\n"); | ||
| 150 | if (evemu_has_event(test->evemu, EV_ABS, ABS_MT_PRESSURE)) | ||
| 151 | fprintf(stderr, "\tpressure\n"); | ||
| 152 | if (evemu_has_event(test->evemu, EV_ABS, ABS_MT_DISTANCE)) | ||
| 153 | fprintf(stderr, "\tdistance\n"); | ||
| 154 | } | ||
| 155 | |||
| 156 | int main(int argc, char *argv[]) | ||
| 157 | { | ||
| 158 | struct frame_test test; | ||
| 159 | int fd; | ||
| 160 | |||
| 161 | if (argc < 2) { | ||
| 162 | fprintf(stderr, "Usage: %s <device>\n", argv[0]); | ||
| 163 | return -1; | ||
| 164 | } | ||
| 165 | |||
| 166 | fd = open(argv[1], O_RDONLY | O_NONBLOCK); | ||
| 167 | if (fd < 0) { | ||
| 168 | fprintf(stderr, "error: could not open device\n"); | ||
| 169 | return -1; | ||
| 170 | } | ||
| 171 | if (ioctl(fd, EVIOCGRAB, 1)) { | ||
| 172 | fprintf(stderr, "error: could not grab the device\n"); | ||
| 173 | return -1; | ||
| 174 | } | ||
| 175 | |||
| 176 | if (init_evemu(&test, fd)) { | ||
| 177 | fprintf(stderr, "error: could not describe device\n"); | ||
| 178 | return -1; | ||
| 179 | } | ||
| 180 | if (!utouch_frame_is_supported_mtdev(test.evemu)) { | ||
| 181 | fprintf(stderr, "error: unsupported device\n"); | ||
| 182 | return -1; | ||
| 183 | } | ||
| 184 | |||
| 185 | fprintf(stderr, "device: %s\n", evemu_get_name(test.evemu)); | ||
| 186 | |||
| 187 | if (init_mtdev(&test, fd)) { | ||
| 188 | fprintf(stderr, "error: could not init mtdev\n"); | ||
| 189 | return -1; | ||
| 190 | } | ||
| 191 | if (init_frame(&test, fd)) { | ||
| 192 | fprintf(stderr, "error: could not init frame\n"); | ||
| 193 | return -1; | ||
| 194 | } | ||
| 195 | |||
| 196 | report_device_caps(&test); | ||
| 197 | |||
| 198 | loop_device(&test, fd); | ||
| 199 | |||
| 200 | destroy_all(&test); | ||
| 201 | return 0; | ||
| 202 | } | ||
diff --git a/utouch-frame.pc.in b/utouch-frame.pc.in new file mode 100644 index 0000000..cbb305a --- /dev/null +++ b/utouch-frame.pc.in | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | prefix=@prefix@ | ||
| 2 | exec_prefix=@exec_prefix@ | ||
| 3 | libdir=@libdir@ | ||
| 4 | includedir=@includedir@ | ||
| 5 | |||
| 6 | Name: utouch-frame | ||
| 7 | Description: Touch Frame Library | ||
| 8 | Version: @PACKAGE_VERSION@ | ||
| 9 | Libs: -L${libdir} -lutouch-frame | ||
