~oif-team/geis/2.1.2

« back to all changes in this revision

Viewing changes to doc/using_geis_v2.dox

  • Committer: Stephen M. Webb
  • Date: 2011-03-17 04:06:04 UTC
  • mto: This revision was merged to the branch mainline in revision 117.
  • Revision ID: stephen.webb@canonical.com-20110317040604-ro1xq4wm6elg903c
Refined the API documentation and added an examples directory.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 
 
3
@page using_geis_v2 Using The Advanced Interface
 
4
 
 
5
@section using_geis_v2_intro Introduction to the Advanced GEIS Interface
 
6
 
 
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>.
 
11
 
 
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
 
18
 
 
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.
 
23
 
 
24
Please note that these examples omit all of the error checking for expository
 
25
purposes only.  
 
26
 
 
27
@dontinclude geis2.c
 
28
 
 
29
First, some objects are declared.
 
30
@skip GeisStatus
 
31
@until int
 
32
 
 
33
The API instance is created.  We tell it to report input devices and gesture
 
34
classes.
 
35
@until NULL
 
36
 
 
37
A subscription object is created.  We want gesture continuations.
 
38
@line geis_subscription_new
 
39
 
 
40
An empty filter is created.  An empty filter means <em>all</em> input devices,
 
41
<em>all</em> gestures, <em>all</em> regions.
 
42
@line geis_filter_new
 
43
 
 
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
 
47
@until NULL
 
48
 
 
49
The filter is added to the subscription and the subscription is activated.
 
50
@until geis_subscription_activate
 
51
 
 
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
 
54
event indicator).
 
55
@line geis_get_configuration
 
56
 
 
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
 
63
 
 
64
Finally, the API objects are cleaned up.
 
65
@skip geis_subscription_delete
 
66
@until geis_delete
 
67
 
 
68
@subsection using_geis_v2_examining_devices Examining Devices
 
69
 
 
70
@dontinclude geis2.c
 
71
 
 
72
@skip dump_device_event
 
73
@until }
 
74
@line }
 
75
 
 
76
@example geis2.c
 
77
 
 
78
*/