~oif-packaging/frame/debian

« back to all changes in this revision

Viewing changes to include/oif/frame_backend.h

  • Committer: Daniel d'Andrada
  • Date: 2012-11-08 16:04:20 UTC
  • mto: This revision was merged to the branch mainline in revision 84.
  • Revision ID: daniel.dandrada@canonical.com-20121108160420-ql9g1jm5t9xifyxs
Tags: upstream-2.4.3
ImportĀ upstreamĀ versionĀ 2.4.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * @file oif/frame_backend.h
 
3
 * API for creating objects.
 
4
 */
 
5
 
 
6
#ifndef FRAME_OIF_FRAME_BACKEND_H_
 
7
#define FRAME_OIF_FRAME_BACKEND_H_
 
8
 
 
9
/* front end definitions */
 
10
#include <oif/frame.h>
 
11
 
 
12
#ifdef __cplusplus
 
13
extern "C" {
 
14
#endif
 
15
 
 
16
/** Handle for a device to be used on the backend API */
 
17
typedef struct UFBackendDevice_* UFBackendDevice;
 
18
 
 
19
/** Handle for a frame to be used on the backend API */
 
20
typedef struct UFBackendFrame_* UFBackendFrame;
 
21
 
 
22
/** Handle for a touch to be used on the backend API */
 
23
typedef struct UFBackendTouch_* UFBackendTouch;
 
24
 
 
25
/********************************************************************
 
26
 * Event
 
27
 ********************************************************************/
 
28
 
 
29
/**
 
30
 * Creates a new event with a reference count of one.
 
31
 */
 
32
FRAME_PUBLIC
 
33
UFEvent frame_event_new();
 
34
 
 
35
/**
 
36
 * Sets the type of the given event
 
37
 */
 
38
FRAME_PUBLIC
 
39
void frame_event_set_type(UFEvent event, UFEventType type);
 
40
 
 
41
/**
 
42
 * Sets the device property of the given event
 
43
 *
 
44
 * It increases the reference count of the corresponding UFDevice by one.
 
45
 */
 
46
FRAME_PUBLIC
 
47
void frame_event_set_device(UFEvent event, UFBackendDevice device);
 
48
 
 
49
/**
 
50
 * Sets the frame property of the given event
 
51
 *
 
52
 * It increases the reference count of the corresponding UFFrame by one.
 
53
 */
 
54
FRAME_PUBLIC
 
55
void frame_event_set_frame(UFEvent event, UFBackendFrame frame);
 
56
 
 
57
/**
 
58
 * Sets the time of the given event
 
59
 */
 
60
FRAME_PUBLIC
 
61
void frame_event_set_time(UFEvent event, uint64_t time);
 
62
 
 
63
/********************************************************************
 
64
 * Device
 
65
 ********************************************************************/
 
66
 
 
67
/**
 
68
 * Creates a new UFDevice and returns its backend handle.
 
69
 */
 
70
FRAME_PUBLIC
 
71
UFBackendDevice frame_backend_device_new();
 
72
 
 
73
/**
 
74
 * Returns a UFDevice instance given its backend handle.
 
75
 */
 
76
FRAME_PUBLIC
 
77
UFDevice frame_backend_device_get_device(UFBackendDevice device);
 
78
 
 
79
/**
 
80
 * Sets the "Name" property of the given device
 
81
 */
 
82
FRAME_PUBLIC
 
83
void frame_backend_device_set_name(UFBackendDevice device, const char *name);
 
84
 
 
85
/**
 
86
 * Sets the "Direct" property of the given device
 
87
 */
 
88
FRAME_PUBLIC
 
89
void frame_backend_device_set_direct(UFBackendDevice device, int direct);
 
90
 
 
91
/**
 
92
 * Sets the "Independent" property of the given device
 
93
 */
 
94
FRAME_PUBLIC
 
95
void frame_backend_device_set_independent(UFBackendDevice device, int independent);
 
96
 
 
97
/**
 
98
 * Sets the "SemiMT" property of the given device
 
99
 */
 
100
FRAME_PUBLIC
 
101
void frame_backend_device_set_semi_mt(UFBackendDevice device, int semi_mt);
 
102
 
 
103
/**
 
104
 * Sets the "MaxTouches" property of the given device
 
105
 */
 
106
FRAME_PUBLIC
 
107
void frame_backend_device_set_max_touches(UFBackendDevice device, unsigned int max_touches);
 
108
 
 
109
/**
 
110
 * Sets the "WindowResolutionX" and "WindowResolutionY" properties of the
 
111
 * given device.
 
112
 */
 
113
FRAME_PUBLIC
 
114
void frame_backend_device_set_window_resolution(UFBackendDevice device, float x, float y);
 
115
 
 
116
/**
 
117
 * Adds an axis to the device
 
118
 */
 
119
FRAME_PUBLIC
 
120
void frame_backend_device_add_axis(UFBackendDevice device,
 
121
                                   UFAxisType type,
 
122
                                   float min, float max, float resolution);
 
123
 
 
124
/**
 
125
 * Deletes the backend handle of a UFDevice, decreasing its reference count by one.
 
126
 */
 
127
FRAME_PUBLIC
 
128
void frame_backend_device_delete(UFBackendDevice device);
 
129
 
 
130
/********************************************************************
 
131
 * Frame
 
132
 ********************************************************************/
 
133
 
 
134
/**
 
135
 * Creates a new, empty, UFFrame and returns its backend handle.
 
136
 *
 
137
 * Usually you will use this method only for the very first frame. For all
 
138
 * subsequent ones it will be safer and more convinent to use
 
139
 * frame_backend_frame_create_next().
 
140
 */
 
141
FRAME_PUBLIC
 
142
UFBackendFrame frame_backend_frame_new();
 
143
 
 
144
/**
 
145
 * Creates a new UFFrame that is a continuation of the given one.
 
146
 *
 
147
 * Touches that had a "begin" state on the given frame will be hard-copied and
 
148
 * have an "update" state on the new frame.
 
149
 *
 
150
 * Touches that had an "update" state will be lazily copied to the new frame.
 
151
 *
 
152
 * Touches that had a "end" state on the given frame won't be present
 
153
 * on the new frame.
 
154
 */
 
155
FRAME_PUBLIC
 
156
UFBackendFrame frame_backend_frame_create_next(UFBackendFrame frame);
 
157
 
 
158
/**
 
159
 * Returns a UFFrame instance given its backend handle.
 
160
 */
 
161
FRAME_PUBLIC
 
162
UFFrame frame_backend_frame_get_frame(UFBackendFrame frame);
 
163
 
 
164
/**
 
165
 * Gets a UFBackendTouch for the UFTouch that has the given id.
 
166
 *
 
167
 * The underlying UFTouch is moved from the given frame to the returned UFBackendTouch.
 
168
 * Once done modifying the touch you're expected to return it to the frame via
 
169
 * frame_backend_frame_give_touch().
 
170
 *
 
171
 * If the underlying UFTouch is a lazy copy (likely from a touch in the previous frame), a hard copy
 
172
 * will be made upon the first change made to it.
 
173
 *
 
174
 * Possible errors: UFStatusErrorInvalidTouch
 
175
 */
 
176
FRAME_PUBLIC
 
177
UFStatus frame_backend_frame_borrow_touch_by_id(UFBackendFrame frame,
 
178
                                                UFTouchId id,
 
179
                                                UFBackendTouch *touch);
 
180
 
 
181
/**
 
182
 * Sets the "Device" property of the given frame
 
183
 */
 
184
FRAME_PUBLIC
 
185
void frame_backend_frame_set_device(UFBackendFrame frame, UFBackendDevice device);
 
186
 
 
187
/**
 
188
 * Sets the "WindowId" property of the given frame
 
189
 */
 
190
FRAME_PUBLIC
 
191
void frame_backend_frame_set_window_id(UFBackendFrame frame, UFWindowId window_id);
 
192
 
 
193
/**
 
194
 * Sets the "ActiveTouches" property of the given frame
 
195
 *
 
196
 * If unset this property returns the number of touches.
 
197
 */
 
198
FRAME_PUBLIC
 
199
void frame_backend_frame_set_active_touches(UFBackendFrame frame, unsigned int active_touches);
 
200
 
 
201
/**
 
202
 * Gives a UFTouch to the specified frame.
 
203
 *
 
204
 * Gives the underlying UFTouch to the specified frame. The UFBackendTouch
 
205
 * is deleted and no longer valid after this call.
 
206
 *
 
207
 * Possible errors: UFStatusErrorTouchIdExists
 
208
 */
 
209
FRAME_PUBLIC
 
210
UFStatus frame_backend_frame_give_touch(UFBackendFrame frame, UFBackendTouch *touch);
 
211
 
 
212
/**
 
213
 * Deletes the backend handle of a UFFrame,
 
214
 * decreasing its reference count by one.
 
215
 */
 
216
FRAME_PUBLIC
 
217
void frame_backend_frame_delete(UFBackendFrame frame);
 
218
 
 
219
/********************************************************************
 
220
 * Touch
 
221
 ********************************************************************/
 
222
 
 
223
/**
 
224
 * Creates a new UFTouch and returns its backend handle.
 
225
 *
 
226
 * Its state will be set to "Begin".
 
227
 *
 
228
 * After filled out, it should be given to a frame via frame_backend_frame_give_touch()
 
229
 */
 
230
FRAME_PUBLIC
 
231
UFBackendTouch frame_backend_touch_new();
 
232
 
 
233
/**
 
234
 * Returns a UFTouch instance given its backend handle.
 
235
 */
 
236
FRAME_PUBLIC
 
237
UFTouch frame_backend_touch_get_touch(UFBackendTouch touch);
 
238
 
 
239
/**
 
240
 * Sets the "Id" property of the given touch
 
241
 */
 
242
FRAME_PUBLIC
 
243
void frame_backend_touch_set_id(UFBackendTouch touch, UFTouchId id);
 
244
 
 
245
/**
 
246
 * Sets the "State" property of the given touch to "End"
 
247
 */
 
248
FRAME_PUBLIC
 
249
void frame_backend_touch_set_ended(UFBackendTouch touch);
 
250
 
 
251
/**
 
252
 * Sets the "WindowX" and "WindowY" properties of the given touch
 
253
 */
 
254
FRAME_PUBLIC
 
255
void frame_backend_touch_set_window_pos(UFBackendTouch touch, float x, float y);
 
256
 
 
257
/**
 
258
 * Sets the "Time" property of the given touch
 
259
 */
 
260
FRAME_PUBLIC
 
261
void frame_backend_touch_set_time(UFBackendTouch touch, uint64_t time);
 
262
 
 
263
/**
 
264
 * Sets the "StartTime" property of the given touch
 
265
 */
 
266
FRAME_PUBLIC
 
267
void frame_backend_touch_set_start_time(UFBackendTouch touch, uint64_t start_time);
 
268
 
 
269
/**
 
270
 * Sets the "Owned" property of the given touch
 
271
 */
 
272
FRAME_PUBLIC
 
273
void frame_backend_touch_set_owned(UFBackendTouch touch, int owned);
 
274
 
 
275
/**
 
276
 * Sets the "PendingEnd" property of the given touch
 
277
 */
 
278
FRAME_PUBLIC
 
279
void frame_backend_touch_set_pending_end(UFBackendTouch touch, int pending_end);
 
280
 
 
281
/**
 
282
 * Sets the value of an axis of the given touch
 
283
 */
 
284
FRAME_PUBLIC
 
285
void frame_backend_touch_set_value(UFBackendTouch touch, UFAxisType type, float value);
 
286
 
 
287
#ifdef __cplusplus
 
288
}
 
289
#endif
 
290
 
 
291
#endif /* FRAME_OIF_FRAME_BACKEND_H_ */