summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/grail.h94
1 files changed, 48 insertions, 46 deletions
diff --git a/include/grail.h b/include/grail.h
index d21d9e8..b208556 100644
--- a/include/grail.h
+++ b/include/grail.h
@@ -26,11 +26,14 @@
26#include <linux/input.h> 26#include <linux/input.h>
27#include <grail-bits.h> 27#include <grail-bits.h>
28#include <grail-types.h> 28#include <grail-types.h>
29#include <utouch/frame.h>
29 30
30#ifdef __cplusplus 31#ifdef __cplusplus
31extern "C" { 32extern "C" {
32#endif 33#endif
33 34
35#define GRAIL_VERSION 0x00011000
36
34#define DIM_GRAIL_TYPE 64 37#define DIM_GRAIL_TYPE 64
35#define DIM_GRAIL_TYPE_BYTES ((DIM_GRAIL_TYPE + 7) >> 3) 38#define DIM_GRAIL_TYPE_BYTES ((DIM_GRAIL_TYPE + 7) >> 3)
36 39
@@ -41,8 +44,21 @@ extern "C" {
41#define GRAIL_STATUS_UPDATE 1 44#define GRAIL_STATUS_UPDATE 1
42#define GRAIL_STATUS_END 2 45#define GRAIL_STATUS_END 2
43 46
44typedef float grail_prop_t; /* gesture properties */ 47typedef float grail_prop_t; /* gesture properties */
45typedef __u64 grail_time_t; /* time in milliseconds */ 48typedef utouch_frame_time_t grail_time_t; /* time in milliseconds */
49
50/**
51 * struct grail_get_version - get grail library version
52 *
53 * Report the version of the grail library, which can be different from
54 * the value of GRAIL_VERSION in this header file.
55 *
56 * This function allows for fallback options from major interface
57 * extensions within the same ABI version. For the normal cases of ABI
58 * agnostic or backwards incompatible changes, this function is not
59 * needed.
60 */
61unsigned int GRAIL_PUBLIC grail_get_version(void);
46 62
47/** 63/**
48 * struct grail_coord - coordinate in bounding box units 64 * struct grail_coord - coordinate in bounding box units
@@ -54,33 +70,6 @@ struct grail_coord {
54}; 70};
55 71
56/** 72/**
57 * struct grail_contact - MT event information in bounding box units
58 * @id: Contact tracking id
59 * @tool_type: Tool type (ABS_MT_TOOL_TYPE)
60 * @pos: Position of contact (bbox units)
61 * @touch_major: Major axis of contact shape (bbox units)
62 * @touch_minor: Minor axis of contact shape (bbox units)
63 * @width_major: Major axis of perimeter (bbox units)
64 * @width_minor: Minor axis of perimeter (bbox units)
65 * @angle: Angle of orientation (vertical: 0 horizontal: +-M_PI_2)
66 * @pressure: Pressure of contact (min: 0 max: 1)
67 *
68 * Depending on the native support of the underlying device, some or all of
69 * the listed properties may be computed.
70 */
71struct grail_contact {
72 int id;
73 int tool_type;
74 struct grail_coord pos;
75 float touch_major;
76 float touch_minor;
77 float width_major;
78 float width_minor;
79 float angle;
80 float pressure;
81};
82
83/**
84 * struct grail_client_id - Gesture client information 73 * struct grail_client_id - Gesture client information
85 * @client: Client id 74 * @client: Client id
86 * @root: Root window 75 * @root: Root window
@@ -231,19 +220,6 @@ void GRAIL_PUBLIC grail_set_bbox(struct grail *ge,
231 const struct grail_coord *max); 220 const struct grail_coord *max);
232 221
233/** 222/**
234 * grail_filter_abs_events - filter kernel motion events
235 * @ge: the grail device in use
236 * @usage: When true, filter kernel motion events.
237 *
238 * Single-finger pointer events are treated as pointer gestures in
239 * grail. When filter_motion_events is non-zero, the kernel events
240 * corresponding to pointer movement are removed from the event
241 * stream.
242 *
243 */
244void GRAIL_PUBLIC grail_filter_abs_events(struct grail *ge, int usage);
245
246/**
247 * grail_get_units - get device coordinate ranges 223 * grail_get_units - get device coordinate ranges
248 * @ge: the grail device in use 224 * @ge: the grail device in use
249 * @min: minimum x and y coordinates 225 * @min: minimum x and y coordinates
@@ -260,17 +236,43 @@ void GRAIL_PUBLIC grail_get_units(const struct grail *ge,
260 struct grail_coord *max); 236 struct grail_coord *max);
261 237
262/** 238/**
263 * grail_get_contacts - get current contact state 239 * grail_get_contact_frame - get current contact frame
264 * @ge: the grail device in use 240 * @ge: the grail device in use
265 * @touch: array of contacts to be filled in
266 * @max_touch: maximum number of contacts supported by the array
267 * 241 *
268 * Extract the contact state as currently seen by grail. 242 * Return the contact frame current being processed. If called from
243 * within a gesture callback, it is guaranteed to return the frame
244 * corresponding to the gesture.
245 *
246 * The returned pointer can be NULL if no input has yet been extracted
247 * through the grail instance.
269 * 248 *
249 * The frame pointer is ABI agnostic, owned by the grail instance, and
250 * has grail scope.
270 */ 251 */
252const struct utouch_frame GRAIL_PUBLIC *
253grail_get_contact_frame(const struct grail *ge);
254
255#ifndef GRAIL_NO_LEGACY_API
256
257struct grail_contact {
258 int id;
259 int tool_type;
260 struct grail_coord pos;
261 float touch_major;
262 float touch_minor;
263 float width_major;
264 float width_minor;
265 float angle;
266 float pressure;
267};
268
269void GRAIL_PUBLIC grail_filter_abs_events(struct grail *ge, int usage);
270
271int GRAIL_PUBLIC grail_get_contacts(const struct grail *ge, 271int GRAIL_PUBLIC grail_get_contacts(const struct grail *ge,
272 struct grail_contact *touch, int max_touch); 272 struct grail_contact *touch, int max_touch);
273 273
274#endif
275
274#ifdef __cplusplus 276#ifdef __cplusplus
275} 277}
276#endif 278#endif