grail-touch.h   grail-touch.h 
skipping to change at line 32 skipping to change at line 32
#ifndef _GRAIL_TOUCH_H #ifndef _GRAIL_TOUCH_H
#define _GRAIL_TOUCH_H #define _GRAIL_TOUCH_H
#include <grail-bits.h> #include <grail-bits.h>
#include <mtdev.h> #include <mtdev.h>
#define DIM_TOUCH 32 #define DIM_TOUCH 32
#define DIM_TOUCH_BYTES ((DIM_TOUCH + 7) >> 3) #define DIM_TOUCH_BYTES ((DIM_TOUCH + 7) >> 3)
typedef int touch_prop_t;
typedef __u64 touch_time_t; typedef __u64 touch_time_t;
enum touch_prop_list {
TP_POS_X,
TP_POS_Y,
TP_TOUCH_MAJOR,
TP_TOUCH_MINOR,
TP_WIDTH_MAJOR,
TP_WIDTH_MINOR,
TP_ORIENTATION,
TP_PRESSURE,
DIM_TOUCH_PROP
};
#define DIM_TOUCH_PROP_BYTES ((DIM_TOUCH_PROP + 7) >> 3)
struct touch { struct touch {
int active; int active;
int slot; int slot;
touch_prop_t prop[DIM_TOUCH_PROP]; int id;
int tool_type;
int x, y;
int touch_major;
int touch_minor;
int width_major;
int width_minor;
int orientation;
int pressure;
}; };
struct touch_frame { struct touch_frame {
int nactive; int nactive;
int ncreate, nmodify, ndestroy; int ncreate, nmodify, ndestroy;
touch_time_t time; touch_time_t time;
grail_mask_t touches[DIM_TOUCH_BYTES]; grail_mask_t touches[DIM_TOUCH_BYTES];
struct touch *active[DIM_TOUCH]; struct touch *active[DIM_TOUCH];
struct touch touch[DIM_TOUCH]; struct touch touch[DIM_TOUCH];
}; };
struct touch_dev_caps { struct touch_caps {
grail_mask_t mask[DIM_TOUCH_PROP_BYTES]; float min_x, max_x;
struct input_absinfo info[DIM_TOUCH_PROP]; float min_y, max_y;
float min_orient, max_orient;
float min_press, max_press;
}; };
struct touch_dev { struct touch_dev {
void (*event)(struct touch_dev *dev, const struct input_event *ev); void (*event)(struct touch_dev *dev, const struct input_event *ev);
void (*create)(struct touch_dev *dev, int slot,
const grail_mask_t *mask, const touch_prop_t *prop);
void (*modify)(struct touch_dev *dev, int slot,
const grail_mask_t *mask, const touch_prop_t *prop);
void (*destroy)(struct touch_dev *dev, int slot);
void (*sync)(struct touch_dev *dev, const struct input_event *syn); void (*sync)(struct touch_dev *dev, const struct input_event *syn);
struct touch_dev_caps caps;
struct touch_dev_impl *impl;
void *priv; void *priv;
}; struct mtdev mtdev;
struct touch_engine {
void (*event)(struct touch_engine *engine,
const struct input_event *ev);
void (*sync)(struct touch_engine *engine,
const struct input_event *syn);
struct touch_frame frame; struct touch_frame frame;
void *priv; struct touch_caps caps;
int slot;
int state;
}; };
void touch_caps_init(struct touch_dev *dev);
float touch_angle(const struct touch_dev *dev, int orientation);
float touch_pressure(const struct touch_dev *dev, int pressure);
int touch_dev_open(struct touch_dev *dev, int fd); int touch_dev_open(struct touch_dev *dev, int fd);
int touch_dev_idle(struct touch_dev *dev, int fd, int ms); int touch_dev_idle(struct touch_dev *dev, int fd, int ms);
int touch_dev_pull(struct touch_dev *dev, int fd); int touch_dev_pull(struct touch_dev *dev, int fd);
void touch_dev_close(struct touch_dev *dev, int fd); void touch_dev_close(struct touch_dev *dev, int fd);
void touch_engine_init(struct touch_engine *engine,
void (*event)(struct touch_engine *engine,
const struct input_event *ev),
void (*sync)(struct touch_engine *engine,
const struct input_event *ev),
void *priv);
void touch_engine_attach(struct touch_engine *engine, struct touch_dev *dev
);
void touch_engine_detach(struct touch_engine *engine, struct touch_dev *dev
);
#endif #endif
 End of changes. 10 change blocks. 
45 lines changed or deleted 22 lines changed or added


 grail-types.h   grail-types.h 
skipping to change at line 60 skipping to change at line 60
#define GRAIL_TYPE_TAP5 19 /* five-finger single tap */ #define GRAIL_TYPE_TAP5 19 /* five-finger single tap */
#define GRAIL_TYPE_EDRAG 20 /* three-finger environment drag */ #define GRAIL_TYPE_EDRAG 20 /* three-finger environment drag */
#define GRAIL_TYPE_EPINCH 21 /* three-finger environment drag */ #define GRAIL_TYPE_EPINCH 21 /* three-finger environment drag */
#define GRAIL_TYPE_EROTATE 22 /* three-finger environment drag */ #define GRAIL_TYPE_EROTATE 22 /* three-finger environment drag */
#define GRAIL_TYPE_MDRAG 23 /* four-finger meta drag */ #define GRAIL_TYPE_MDRAG 23 /* four-finger meta drag */
#define GRAIL_TYPE_MPINCH 24 /* four-finger meta drag */ #define GRAIL_TYPE_MPINCH 24 /* four-finger meta drag */
#define GRAIL_TYPE_MROTATE 25 /* four-finger meta drag */ #define GRAIL_TYPE_MROTATE 25 /* four-finger meta drag */
#define GRAIL_TYPE_SYSFLAG1 26 /* reserved system flag */
#define GRAIL_MAIN_DRAG 0 #define GRAIL_MAIN_DRAG 0
#define GRAIL_MAIN_PINCH 1
#define GRAIL_MAIN_ROTATE 2
#define GRAIL_MAIN_TAP 3
#define GRAIL_MAIN_SYSFLAG 4
#define GRAIL_PROP_DRAG_DX 0 /* horizontal position delta */ #define GRAIL_PROP_DRAG_DX 0 /* horizontal position delta */
#define GRAIL_PROP_DRAG_DY 1 /* vertical position delta */ #define GRAIL_PROP_DRAG_DY 1 /* vertical position delta */
#define GRAIL_PROP_DRAG_VX 2 /* horizontal velocity */ #define GRAIL_PROP_DRAG_VX 2 /* horizontal velocity */
#define GRAIL_PROP_DRAG_VY 3 /* vertical velocity */ #define GRAIL_PROP_DRAG_VY 3 /* vertical velocity */
#define GRAIL_PROP_DRAG_X 4 /* horizontal position */ #define GRAIL_PROP_DRAG_X 4 /* horizontal position */
#define GRAIL_PROP_DRAG_Y 5 /* vertical position */ #define GRAIL_PROP_DRAG_Y 5 /* vertical position */
#define GRAIL_PROP_DRAG_X1 6 /* bounding box x1 */
#define GRAIL_PROP_DRAG_Y1 7 /* bounding box y1 */
#define GRAIL_PROP_DRAG_X2 8 /* bounding box x2 */
#define GRAIL_PROP_DRAG_Y2 9 /* bounding box y2 */
#define GRAIL_PROP_DRAG_ID_T0 10 /* first touch id */
#define GRAIL_PROP_DRAG_X_T0 11 /* first touch horizontal position *
/
#define GRAIL_PROP_DRAG_Y_T0 12 /* first touch vertical position */
#define GRAIL_PROP_DRAG_ID_T1 13
#define GRAIL_PROP_DRAG_X_T1 14
#define GRAIL_PROP_DRAG_Y_T1 15
#define GRAIL_PROP_DRAG_ID_T2 16
#define GRAIL_PROP_DRAG_X_T2 17
#define GRAIL_PROP_DRAG_Y_T2 18
#define GRAIL_PROP_DRAG_ID_T3 19
#define GRAIL_PROP_DRAG_X_T3 20
#define GRAIL_PROP_DRAG_Y_T3 21
#define GRAIL_PROP_DRAG_ID_T4 22
#define GRAIL_PROP_DRAG_X_T4 23
#define GRAIL_PROP_DRAG_Y_T4 24
#define GRAIL_MAIN_PINCH 1
#define GRAIL_PROP_PINCH_DR 0 /* radius delta */ #define GRAIL_PROP_PINCH_DR 0 /* radius delta */
#define GRAIL_PROP_PINCH_VR 1 /* radial velocity */ #define GRAIL_PROP_PINCH_VR 1 /* radial velocity */
#define GRAIL_PROP_PINCH_R 2 /* radius */ #define GRAIL_PROP_PINCH_R 2 /* radius */
#define GRAIL_PROP_PINCH_X1 3 /* bounding box x1 */ #define GRAIL_PROP_PINCH_X1 3 /* bounding box x1 */
#define GRAIL_PROP_PINCH_Y1 4 /* bounding box y1 */ #define GRAIL_PROP_PINCH_Y1 4 /* bounding box y1 */
#define GRAIL_PROP_PINCH_X2 5 /* bounding box x2 */ #define GRAIL_PROP_PINCH_X2 5 /* bounding box x2 */
#define GRAIL_PROP_PINCH_Y2 6 /* bounding box y2 */ #define GRAIL_PROP_PINCH_Y2 6 /* bounding box y2 */
#define GRAIL_PROP_PINCH_ID_T0 7 /* first touch id */
#define GRAIL_PROP_PINCH_X_T0 8 /* first touch horizontal position *
/
#define GRAIL_PROP_PINCH_Y_T0 9 /* first touch vertical position */
#define GRAIL_PROP_PINCH_ID_T1 10
#define GRAIL_PROP_PINCH_X_T1 11
#define GRAIL_PROP_PINCH_Y_T1 12
#define GRAIL_PROP_PINCH_ID_T2 13
#define GRAIL_PROP_PINCH_X_T2 14
#define GRAIL_PROP_PINCH_Y_T2 15
#define GRAIL_PROP_PINCH_ID_T3 16
#define GRAIL_PROP_PINCH_X_T3 17
#define GRAIL_PROP_PINCH_Y_T3 18
#define GRAIL_PROP_PINCH_ID_T4 19
#define GRAIL_PROP_PINCH_X_T4 20
#define GRAIL_PROP_PINCH_Y_T4 21
#define GRAIL_MAIN_ROTATE 2
#define GRAIL_PROP_ROTATE_DA 0 /* angle delta */ #define GRAIL_PROP_ROTATE_DA 0 /* angle delta */
#define GRAIL_PROP_ROTATE_VA 1 /* angular velocity */ #define GRAIL_PROP_ROTATE_VA 1 /* angular velocity */
#define GRAIL_PROP_ROTATE_A 2 /* angle */ #define GRAIL_PROP_ROTATE_A 2 /* angle */
#define GRAIL_PROP_ROTATE_X1 3 /* bounding box x1 */ #define GRAIL_PROP_ROTATE_X1 3 /* bounding box x1 */
#define GRAIL_PROP_ROTATE_Y1 4 /* bounding box y1 */ #define GRAIL_PROP_ROTATE_Y1 4 /* bounding box y1 */
#define GRAIL_PROP_ROTATE_X2 5 /* bounding box x2 */ #define GRAIL_PROP_ROTATE_X2 5 /* bounding box x2 */
#define GRAIL_PROP_ROTATE_Y2 6 /* bounding box y2 */ #define GRAIL_PROP_ROTATE_Y2 6 /* bounding box y2 */
#define GRAIL_PROP_ROTATE_ID_T0 7 /* first touch id */
#define GRAIL_PROP_ROTATE_X_T0 8 /* first touch horizontal position *
/
#define GRAIL_PROP_ROTATE_Y_T0 9 /* first touch vertical position */
#define GRAIL_PROP_ROTATE_ID_T1 10
#define GRAIL_PROP_ROTATE_X_T1 11
#define GRAIL_PROP_ROTATE_Y_T1 12
#define GRAIL_PROP_ROTATE_ID_T2 13
#define GRAIL_PROP_ROTATE_X_T2 14
#define GRAIL_PROP_ROTATE_Y_T2 15
#define GRAIL_PROP_ROTATE_ID_T3 16
#define GRAIL_PROP_ROTATE_X_T3 17
#define GRAIL_PROP_ROTATE_Y_T3 18
#define GRAIL_PROP_ROTATE_ID_T4 19
#define GRAIL_PROP_ROTATE_X_T4 20
#define GRAIL_PROP_ROTATE_Y_T4 21
#define GRAIL_MAIN_TAP 3
#define GRAIL_PROP_TAP_DT 0 /* tap time (ms) */ #define GRAIL_PROP_TAP_DT 0 /* tap time (ms) */
#define GRAIL_PROP_TAP_X 1 /* horizontal position */ #define GRAIL_PROP_TAP_X 1 /* horizontal position */
#define GRAIL_PROP_TAP_Y 2 /* vertical position */ #define GRAIL_PROP_TAP_Y 2 /* vertical position */
#define GRAIL_PROP_TAP_X1 3 /* bounding box x1 */
#define GRAIL_PROP_TAP_Y1 4 /* bounding box y1 */
#define GRAIL_PROP_TAP_X2 5 /* bounding box x2 */
#define GRAIL_PROP_TAP_Y2 6 /* bounding box y2 */
#define GRAIL_PROP_TAP_ID_T0 7 /* first touch id */
#define GRAIL_PROP_TAP_X_T0 8 /* first touch horizontal position *
/
#define GRAIL_PROP_TAP_Y_T0 9 /* first touch vertical position */
#define GRAIL_PROP_TAP_ID_T1 10
#define GRAIL_PROP_TAP_X_T1 11
#define GRAIL_PROP_TAP_Y_T1 12
#define GRAIL_PROP_TAP_ID_T2 13
#define GRAIL_PROP_TAP_X_T2 14
#define GRAIL_PROP_TAP_Y_T2 15
#define GRAIL_PROP_TAP_ID_T3 16
#define GRAIL_PROP_TAP_X_T3 17
#define GRAIL_PROP_TAP_Y_T3 18
#define GRAIL_PROP_TAP_ID_T4 19
#define GRAIL_PROP_TAP_X_T4 20
#define GRAIL_PROP_TAP_Y_T4 21
#endif #endif
 End of changes. 9 change blocks. 
3 lines changed or deleted 79 lines changed or added


 grail.h   grail.h 
skipping to change at line 33 skipping to change at line 33
#ifndef _GRAIL_H #ifndef _GRAIL_H
#define _GRAIL_H #define _GRAIL_H
#include <grail-bits.h> #include <grail-bits.h>
#include <grail-types.h> #include <grail-types.h>
#include <linux/input.h> #include <linux/input.h>
#define DIM_GRAIL_TYPE 64 #define DIM_GRAIL_TYPE 64
#define DIM_GRAIL_TYPE_BYTES ((DIM_GRAIL_TYPE + 7) >> 3) #define DIM_GRAIL_TYPE_BYTES ((DIM_GRAIL_TYPE + 7) >> 3)
#define DIM_GRAIL_PROP 16 #define DIM_GRAIL_PROP 32
#define DIM_GRAIL_PROP_BYTES ((DIM_GRAIL_PROP + 7) >> 3) #define DIM_GRAIL_PROP_BYTES ((DIM_GRAIL_PROP + 7) >> 3)
#define GRAIL_STATUS_BEGIN 0 #define GRAIL_STATUS_BEGIN 0
#define GRAIL_STATUS_UPDATE 1 #define GRAIL_STATUS_UPDATE 1
#define GRAIL_STATUS_END 2 #define GRAIL_STATUS_END 2
typedef float grail_prop_t; typedef float grail_prop_t; /* gesture properties */
typedef __u64 grail_time_t; typedef __u64 grail_time_t; /* time in milliseconds */
/**
* struct grail_coord - coordinate in bounding box units
* @x: the horizontal position (bbox units)
* @y: the vertical position (bbox units)
*/
struct grail_coord { struct grail_coord {
float x, y; float x, y;
}; };
/**
* struct grail_contact - MT event information in bounding box units
* @id: Contact tracking id
* @tool_type: Tool type (ABS_MT_TOOL_TYPE)
* @pos: Position of contact (bbox units)
* @touch_major: Major axis of contact shape (bbox units)
* @touch_minor: Minor axis of contact shape (bbox units)
* @width_major: Major axis of perimeter (bbox units)
* @width_minor: Minor axis of perimeter (bbox units)
* @angle: Angle of orientation (vertical: 0 horizontal: +-M_PI_2)
* @pressure: Pressure of contact (min: 0 max: 1)
*
* Depending on the native support of the underlying device, some or all of
* the listed properties may be computed.
*/
struct grail_contact {
int id;
int tool_type;
struct grail_coord pos;
float touch_major;
float touch_minor;
float width_major;
float width_minor;
float angle;
float pressure;
};
/**
* struct grail_client_id - Gesture client information
* @client: Client id
* @root: Root window
* @event: Window to route events to
* @child: Window the event occured in
*
* This struct is treated opaquely, and only has meaning to the gesture
* client. Details are subject to change.
*/
struct grail_client_id { struct grail_client_id {
int client; int client;
int root, event, child; int root, event, child;
}; };
/**
* struct grail_client_info - Gesture request information
* @id: Gesture client id
* @mask: Gestures the client is listening to
*/
struct grail_client_info { struct grail_client_info {
struct grail_client_id id; struct grail_client_id id;
grail_mask_t mask[DIM_GRAIL_TYPE_BYTES]; grail_mask_t mask[DIM_GRAIL_TYPE_BYTES];
}; };
/**
* struct grail_event - Gesture event
* @type: The gesture type
* @id: Unique identifier foof the gesture instance
* @status: Gesture status (begin, update, end)
* @ntouch: Number of current touches
* @nprop: Number of properties in the gesture
* @pos: Focus point of the gesture (bbox coordinates)
* @touch: Array of individual touch information
* @client_id: The gesture client to route the gesture to
* @time: Time of event (milliseconds)
* @prop: Array of properties of the event
*
* Gesture events are passed to the client via the gesture() callback.
*/
struct grail_event { struct grail_event {
int type; int type;
int id; int id;
int status; int status;
int ntouch; int ntouch;
int nprop; int nprop;
struct grail_coord pos; struct grail_coord pos;
struct grail_client_id client_id; struct grail_client_id client_id;
grail_time_t time; grail_time_t time;
grail_prop_t prop[DIM_GRAIL_PROP]; grail_prop_t prop[DIM_GRAIL_PROP];
}; };
/**
* struct grail - Main grail device
* @get_clients: Called at the onset of new gestures to retrieve the list
* of listening clients.
* @event: Callback for kernel events passing through grail.
* @gesture: Main gesture callback.
* @impl: Grail implementation details.
* @gin: Gesture instatiation details.
* @gru: Gesture recognition details.
* @priv: Generic pointer to user-defined content.
*
* The grail device pulls events from the underlying device, detects
* gestures, and passes them on to the client via the gesture()
* callback. Events that are not gesture or for other reasons held back are
* passed on via the event() callback. The user provides information about
* windows and listening clients via the get_clients callback, which is
* called during gesture instantiation.
*
*/
struct grail { struct grail {
int (*get_clients)(struct grail *ge, int (*get_clients)(struct grail *ge,
struct grail_client_info *client, int max_clients , struct grail_client_info *client, int max_clients ,
const struct grail_coord *coords, int num_coords, const struct grail_coord *coords, int num_coords,
const grail_mask_t *types, int type_bytes); const grail_mask_t *types, int type_bytes);
void (*event)(struct grail *ge, void (*event)(struct grail *ge,
const struct input_event *ev); const struct input_event *ev);
void (*gesture)(struct grail *ge, void (*gesture)(struct grail *ge,
const struct grail_event *ev); const struct grail_event *ev);
struct grail_impl *impl; struct grail_impl *impl;
struct gesture_inserter *gin; struct gesture_inserter *gin;
struct gesture_recognizer *gru; struct gesture_recognizer *gru;
void *priv; void *priv;
}; };
/**
* grail_open - open a grail device
* @ge: the grail device to open
* @fd: file descriptor of the kernel device
*
* Initialize the internal grail structures and configure it by reading the
* protocol capabilities through the file descriptor.
*
* The callbacks, parameters and priv pointer should be set prior to this
* call.
*
* Returns zero on success, negative error number otherwise.
*/
int grail_open(struct grail *ge, int fd); int grail_open(struct grail *ge, int fd);
/**
* grail_idle - check state of kernel device
* @ge: the grail device in use
* @fd: file descriptor of the kernel device
* @ms: number of milliseconds to wait for activity
*
* Returns true if the device is idle, i.e., there are no fetched
* events in the pipe and there is nothing to fetch from the device.
*/
int grail_idle(struct grail *ge, int fd, int ms); int grail_idle(struct grail *ge, int fd, int ms);
/**
* grail_pull - pull and process available events from the kernel device
* @ge: the grail device in use
* @fd: file descriptor of the kernel device
*
* Pull all available events and process them. The grail callbacks are
* invoked during this call.
*
* The underlying file descriptor must have O_NONBLOCK set, or this method
* will not return until the file is closed.
*
* On success, returns the number of events read. Otherwise,
* a standard negative error number is returned.
*/
int grail_pull(struct grail *ge, int fd); int grail_pull(struct grail *ge, int fd);
/**
* grail_close - close the grail device
* @ge: the grail device to close
* @fd: file descriptor of the kernel device
*
* Deallocates all memory associated with grail, and clears the grail
* structure.
*/
void grail_close(struct grail *ge, int fd); void grail_close(struct grail *ge, int fd);
/**
* grail_set_bbox - set the grail unit bounding box
* @ge: the grail device in use
* @min: the minimum (lower-left) corner of the bounding box
* @max: the maximum (upper-right) corner of the bounding box
*
* Sets the box within which the device coordinates should be presented.
*/
void grail_set_bbox(struct grail *ge, void grail_set_bbox(struct grail *ge,
const struct grail_coord *min, const struct grail_coord *min,
const struct grail_coord *max); const struct grail_coord *max);
/**
* grail_filter_abs_events - filter kernel motion events
* @ge: the grail device in use
* @usage: When true, filter kernel motion events.
*
* Single-finger pointer events are treated as pointer gestures in
* grail. When filter_motion_events is non-zero, the kernel events
* corresponding to pointer movement are removed from the event
* stream.
*
*/
void grail_filter_abs_events(struct grail *ge, int usage);
/**
* grail_get_units - get device coordinate ranges
* @ge: the grail device in use
* @min: minimum x and y coordinates
* @max: maximum x and y coordinates
*
* The grail event attributes pos, touch_major, touch_minor,
* width_major, and width_minor are all given in device coordinate
* units, unless specified otherwise using the grail_set_bbox()
* function. This function reports the device coordinate ranges.
*
*/
void grail_get_units(const struct grail *ge, void grail_get_units(const struct grail *ge,
struct grail_coord *min, struct grail_coord *max); struct grail_coord *min, struct grail_coord *max);
void grail_filter_abs_events(struct grail *ge, int usage); /**
* grail_get_contacts - get current contact state
* @ge: the grail device in use
* @touch: array of contacts to be filled in
* @max_touch: maximum number of contacts supported by the array
*
* Extract the contact state as currently seen by grail.
*
*/
int grail_get_contacts(const struct grail *ge,
struct grail_contact *touch, int max_touch);
#endif #endif
 End of changes. 14 change blocks. 
4 lines changed or deleted 175 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/