3
@page using_geis_v2 Using The Advanced Interface
5
@section using_geis_v2_intro Introduction to the Advanced GEIS Interface
7
The advanced GEIS interface is designed around the idea that you can create
8
<em>filters</em> to limit the kinds of gestures received and combine those
9
filters into <em>subscriptions</em> that interact with the gesture
10
recognizer to deliver <em>gesture events</em>.
12
The normal flow for using the advanced interface is as follows.
13
-# create a Geis object
14
-# create a GeisSubscription object on the Geis object
15
-# create and add one or more GeisFilter to the GeisSubscription
16
-# activate the GeisSubscription
17
-# wait for and process a series of GeisEvent
19
@subsection using_geis_v2_example An example of advanced API usage
20
This is an example of using the advanced (GEIS v2) API. The full source code
21
for this example (including details missing here) is included in the source
22
distribution of utouch-geis.
24
Please note that these examples omit all of the error checking for expository
29
First, some objects are declared.
33
The API instance is created. We tell it to report input devices and gesture
37
A subscription object is created. We want gesture continuations.
38
@line geis_subscription_new
40
An empty filter is created. An empty filter means <em>all</em> input devices,
41
<em>all</em> gestures, <em>all</em> regions.
44
For the purpose of this example, we want just 2-touch gestures, so we need to
45
add a term to the filter specifying only those gestures with two touches.
46
@skip geis_filter_add_term
49
The filter is added to the subscription and the subscription is activated.
50
@until geis_subscription_activate
52
For the event loop processing, we're going to need the event fd (this is
53
assuming a Unix implementation of GEIS, other platforms may have a different
55
@line geis_get_configuration
57
The application's main event loop is run until a read is indicated as available
58
on the event fd, at which point the GEIS event loop is pumped.
59
@skip geis_dispatch_events
60
@until geis_next_event
61
The events are handled and the event loop pumped until it's empty.
62
@until geis_next_event
64
Finally, the API objects are cleaned up.
65
@skip geis_subscription_delete
68
@subsection using_geis_v2_examining_devices Examining Devices
72
@skip dump_device_event