grail-bits.h   grail-bits.h 
/************************************************************************** *** /************************************************************************** ***
* *
* grail - Gesture Recognition And Instantiation Library * grail - Gesture Recognition And Instantiation Library
* *
* Copyright (C) 2010 Canonical Ltd. * Copyright (C) 2010-2011 Canonical Ltd.
* Copyright (C) 2010 Henrik Rydberg <rydberg@bitmath.org>
* *
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the * under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your * Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. * option) any later version.
* *
* This program is distributed in the hope that it will be useful, but * This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of * WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details. * General Public License for more details.
* *
* You should have received a copy of the GNU General Public License along * You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>. * with this program. If not, see <http://www.gnu.org/licenses/>.
* *
************************************************************************** **/ ************************************************************************** **/
#ifndef _GRAIL_BITS_H #ifndef GRAIL_BITS_H
#define _GRAIL_BITS_H #define GRAIL_BITS_H
#ifdef __cplusplus
extern "C" {
#endif
/* Macros that set symbol visibilities in shared libraries properly.
* Adapted from http://gcc.gnu.org/wiki/Visibility
*/
#if defined _WIN32 || defined __CYGWIN__
#ifdef BUILDING_GRAIL
#define GRAIL_PUBLIC __declspec(dllexport)
#else
#define GRAIL_PUBLIC __declspec(dllimport)
#endif
#define GRAIL_PRIVATE
#else
#if defined __GNUC__
#define GRAIL_PUBLIC __attribute__ ((visibility("default"))
)
#define GRAIL_PRIVATE __attribute__ ((visibility("hidden")
))
#else
#pragma message ("Compiler does not support symbol visibili
ty.")
#define GRAIL_PUBLIC
#define GRAIL_PRIVATE
#endif
#endif
typedef unsigned char grail_mask_t; typedef unsigned char grail_mask_t;
static inline void grail_mask_set(grail_mask_t *mask, int i) static inline void grail_mask_set(grail_mask_t *mask, int i)
{ {
mask[i >> 3] |= (1 << (i & 7)); mask[i >> 3] |= (1 << (i & 7));
} }
static inline void grail_mask_clear(grail_mask_t *mask, int i) static inline void grail_mask_clear(grail_mask_t *mask, int i)
{ {
skipping to change at line 51 skipping to change at line 76
grail_mask_set(mask, i); grail_mask_set(mask, i);
else else
grail_mask_clear(mask, i); grail_mask_clear(mask, i);
} }
static inline int grail_mask_get(const grail_mask_t *mask, int i) static inline int grail_mask_get(const grail_mask_t *mask, int i)
{ {
return (mask[i >> 3] >> (i & 7)) & 1; return (mask[i >> 3] >> (i & 7)) & 1;
} }
void grail_mask_set_mask(grail_mask_t *a, const grail_mask_t *b, int bytes) void GRAIL_PUBLIC grail_mask_set_mask(grail_mask_t *a, const grail_mask_t *
; b,
void grail_mask_clear_mask(grail_mask_t *a, const grail_mask_t *b, int byte int bytes);
s); void GRAIL_PUBLIC grail_mask_clear_mask(grail_mask_t *a, const grail_mask_t
*b,
int bytes);
int grail_mask_count(const grail_mask_t *mask, int bytes); int GRAIL_PUBLIC grail_mask_count(const grail_mask_t *mask, int bytes);
int grail_mask_get_first(const grail_mask_t *mask, int bytes); int GRAIL_PUBLIC grail_mask_get_first(const grail_mask_t *mask, int bytes);
int grail_mask_get_next(int i, const grail_mask_t *mask, int bytes); int GRAIL_PUBLIC grail_mask_get_next(int i, const grail_mask_t *mask,
int bytes);
#define grail_mask_foreach(i, mask, bytes) \ #define grail_mask_foreach(i, mask, bytes) \
for (i = grail_mask_get_first(mask, bytes); \ for (i = grail_mask_get_first(mask, bytes); \
i >= 0; \ i >= 0; \
i = grail_mask_get_next(i, mask, bytes)) i = grail_mask_get_next(i, mask, bytes))
#ifdef __cplusplus
}
#endif
#endif #endif
 End of changes. 5 change blocks. 
11 lines changed or deleted 46 lines changed or added


 grail-types.h   grail-types.h 
/************************************************************************** *** /************************************************************************** ***
* *
* grail - Gesture Recognition And Instantiation Library * grail - Gesture Recognition And Instantiation Library
* *
* Copyright (C) 2010 Canonical Ltd. * Copyright (C) 2010-2011 Canonical Ltd.
* Copyright (C) 2010 Henrik Rydberg <rydberg@bitmath.org>
* *
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the * under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your * Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. * option) any later version.
* *
* This program is distributed in the hope that it will be useful, but * This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of * WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details. * General Public License for more details.
* *
* You should have received a copy of the GNU General Public License along * You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>. * with this program. If not, see <http://www.gnu.org/licenses/>.
* *
************************************************************************** **/ ************************************************************************** **/
#ifndef _GRAIL_TYPES_H #ifndef GRAIL_TYPES_H
#define _GRAIL_TYPES_H #define GRAIL_TYPES_H
#define GRAIL_TYPE_DRAG1 0 /* one-finger drag/pan/scroll */ #define GRAIL_TYPE_DRAG1 0 /* one-finger drag/pan/scroll */
#define GRAIL_TYPE_PINCH1 1 /* one-finger pinch-to-zoom */ #define GRAIL_TYPE_PINCH1 1 /* one-finger pinch-to-zoom */
#define GRAIL_TYPE_ROTATE1 2 /* one-finger rotation */ #define GRAIL_TYPE_ROTATE1 2 /* one-finger rotation */
#define GRAIL_TYPE_DRAG2 3 /* two-finger drag/pan/scroll */ #define GRAIL_TYPE_DRAG2 3 /* two-finger drag/pan/scroll */
#define GRAIL_TYPE_PINCH2 4 /* two-finger pinch-to-zoom */ #define GRAIL_TYPE_PINCH2 4 /* two-finger pinch-to-zoom */
#define GRAIL_TYPE_ROTATE2 5 /* two-finger rotation */ #define GRAIL_TYPE_ROTATE2 5 /* two-finger rotation */
#define GRAIL_TYPE_DRAG3 6 /* three-finger drag/pan */ #define GRAIL_TYPE_DRAG3 6 /* three-finger drag/pan */
skipping to change at line 62 skipping to change at line 61
#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_TYPE_SYSFLAG1 26 /* reserved system flag */
#define GRAIL_TYPE_TOUCH1 32 /* one-finger touch */
#define GRAIL_TYPE_TOUCH2 33 /* two-finger touch */
#define GRAIL_TYPE_TOUCH3 34 /* three-finger touch */
#define GRAIL_TYPE_TOUCH4 35 /* four-finger touch */
#define GRAIL_TYPE_TOUCH5 36 /* five-finger touch */
#define GRAIL_TYPE_ETOUCH 37 /* three-finger environment touch */
#define GRAIL_TYPE_MTOUCH 38 /* four-finger meta touch */
#define GRAIL_MAIN_DRAG 0 #define GRAIL_MAIN_DRAG 0
#define GRAIL_MAIN_PINCH 1 #define GRAIL_MAIN_PINCH 1
#define GRAIL_MAIN_ROTATE 2 #define GRAIL_MAIN_ROTATE 2
#define GRAIL_MAIN_TAP 3 #define GRAIL_MAIN_TAP 3
#define GRAIL_MAIN_SYSFLAG 4 #define GRAIL_MAIN_SYSFLAG 4
#define GRAIL_MAIN_TOUCH 5
#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_X1 6 /* bounding box x1 */
#define GRAIL_PROP_DRAG_Y1 7 /* bounding box y1 */ #define GRAIL_PROP_DRAG_Y1 7 /* bounding box y1 */
#define GRAIL_PROP_DRAG_X2 8 /* bounding box x2 */ #define GRAIL_PROP_DRAG_X2 8 /* bounding box x2 */
skipping to change at line 97 skipping to change at line 105
#define GRAIL_PROP_DRAG_ID_T3 19 #define GRAIL_PROP_DRAG_ID_T3 19
#define GRAIL_PROP_DRAG_X_T3 20 #define GRAIL_PROP_DRAG_X_T3 20
#define GRAIL_PROP_DRAG_Y_T3 21 #define GRAIL_PROP_DRAG_Y_T3 21
#define GRAIL_PROP_DRAG_ID_T4 22 #define GRAIL_PROP_DRAG_ID_T4 22
#define GRAIL_PROP_DRAG_X_T4 23 #define GRAIL_PROP_DRAG_X_T4 23
#define GRAIL_PROP_DRAG_Y_T4 24 #define GRAIL_PROP_DRAG_Y_T4 24
#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_X 3 /* centroid x */
#define GRAIL_PROP_PINCH_Y1 4 /* bounding box y1 */ #define GRAIL_PROP_PINCH_Y 4 /* centroid y */
#define GRAIL_PROP_PINCH_X2 5 /* bounding box x2 */ #define GRAIL_PROP_PINCH_X1 5 /* bounding box x1 */
#define GRAIL_PROP_PINCH_Y2 6 /* bounding box y2 */ #define GRAIL_PROP_PINCH_Y1 6 /* bounding box y1 */
#define GRAIL_PROP_PINCH_ID_T0 7 /* first touch id */ #define GRAIL_PROP_PINCH_X2 7 /* bounding box x2 */
#define GRAIL_PROP_PINCH_X_T0 8 /* first touch horizontal position * #define GRAIL_PROP_PINCH_Y2 8 /* bounding box y2 */
/ #define GRAIL_PROP_PINCH_ID_T0 9 /* first touch id */
#define GRAIL_PROP_PINCH_Y_T0 9 /* first touch vertical position */ #define GRAIL_PROP_PINCH_X_T0 10 /* first touch horizontal position *
#define GRAIL_PROP_PINCH_ID_T1 10 /
#define GRAIL_PROP_PINCH_X_T1 11 #define GRAIL_PROP_PINCH_Y_T0 11 /* first touch vertical position */
#define GRAIL_PROP_PINCH_Y_T1 12 #define GRAIL_PROP_PINCH_ID_T1 12
#define GRAIL_PROP_PINCH_ID_T2 13 #define GRAIL_PROP_PINCH_X_T1 13
#define GRAIL_PROP_PINCH_X_T2 14 #define GRAIL_PROP_PINCH_Y_T1 14
#define GRAIL_PROP_PINCH_Y_T2 15 #define GRAIL_PROP_PINCH_ID_T2 15
#define GRAIL_PROP_PINCH_ID_T3 16 #define GRAIL_PROP_PINCH_X_T2 16
#define GRAIL_PROP_PINCH_X_T3 17 #define GRAIL_PROP_PINCH_Y_T2 17
#define GRAIL_PROP_PINCH_Y_T3 18 #define GRAIL_PROP_PINCH_ID_T3 18
#define GRAIL_PROP_PINCH_ID_T4 19 #define GRAIL_PROP_PINCH_X_T3 19
#define GRAIL_PROP_PINCH_X_T4 20 #define GRAIL_PROP_PINCH_Y_T3 20
#define GRAIL_PROP_PINCH_Y_T4 21 #define GRAIL_PROP_PINCH_ID_T4 21
#define GRAIL_PROP_PINCH_X_T4 22
#define GRAIL_PROP_PINCH_Y_T4 23
#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_X 3 /* centroid x coordinate */
#define GRAIL_PROP_ROTATE_Y1 4 /* bounding box y1 */ #define GRAIL_PROP_ROTATE_Y 4 /* centroid y coordinate */
#define GRAIL_PROP_ROTATE_X2 5 /* bounding box x2 */ #define GRAIL_PROP_ROTATE_X1 5 /* bounding box x1 */
#define GRAIL_PROP_ROTATE_Y2 6 /* bounding box y2 */ #define GRAIL_PROP_ROTATE_Y1 6 /* bounding box y1 */
#define GRAIL_PROP_ROTATE_ID_T0 7 /* first touch id */ #define GRAIL_PROP_ROTATE_X2 7 /* bounding box x2 */
#define GRAIL_PROP_ROTATE_X_T0 8 /* first touch horizontal position * #define GRAIL_PROP_ROTATE_Y2 8 /* bounding box y2 */
/ #define GRAIL_PROP_ROTATE_ID_T0 9 /* first touch id */
#define GRAIL_PROP_ROTATE_Y_T0 9 /* first touch vertical position */ #define GRAIL_PROP_ROTATE_X_T0 10 /* first touch horizontal position *
#define GRAIL_PROP_ROTATE_ID_T1 10 /
#define GRAIL_PROP_ROTATE_X_T1 11 #define GRAIL_PROP_ROTATE_Y_T0 11 /* first touch vertical position */
#define GRAIL_PROP_ROTATE_Y_T1 12 #define GRAIL_PROP_ROTATE_ID_T1 12
#define GRAIL_PROP_ROTATE_ID_T2 13 #define GRAIL_PROP_ROTATE_X_T1 13
#define GRAIL_PROP_ROTATE_X_T2 14 #define GRAIL_PROP_ROTATE_Y_T1 14
#define GRAIL_PROP_ROTATE_Y_T2 15 #define GRAIL_PROP_ROTATE_ID_T2 15
#define GRAIL_PROP_ROTATE_ID_T3 16 #define GRAIL_PROP_ROTATE_X_T2 16
#define GRAIL_PROP_ROTATE_X_T3 17 #define GRAIL_PROP_ROTATE_Y_T2 17
#define GRAIL_PROP_ROTATE_Y_T3 18 #define GRAIL_PROP_ROTATE_ID_T3 18
#define GRAIL_PROP_ROTATE_ID_T4 19 #define GRAIL_PROP_ROTATE_X_T3 19
#define GRAIL_PROP_ROTATE_X_T4 20 #define GRAIL_PROP_ROTATE_Y_T3 20
#define GRAIL_PROP_ROTATE_Y_T4 21 #define GRAIL_PROP_ROTATE_ID_T4 21
#define GRAIL_PROP_ROTATE_X_T4 22
#define GRAIL_PROP_ROTATE_Y_T4 23
#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_X1 3 /* bounding box x1 */
#define GRAIL_PROP_TAP_Y1 4 /* bounding box y1 */ #define GRAIL_PROP_TAP_Y1 4 /* bounding box y1 */
#define GRAIL_PROP_TAP_X2 5 /* bounding box x2 */ #define GRAIL_PROP_TAP_X2 5 /* bounding box x2 */
#define GRAIL_PROP_TAP_Y2 6 /* bounding box y2 */ #define GRAIL_PROP_TAP_Y2 6 /* bounding box y2 */
#define GRAIL_PROP_TAP_ID_T0 7 /* first touch id */ #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_X_T0 8 /* first touch horizontal position * /
skipping to change at line 163 skipping to change at line 175
#define GRAIL_PROP_TAP_ID_T2 13 #define GRAIL_PROP_TAP_ID_T2 13
#define GRAIL_PROP_TAP_X_T2 14 #define GRAIL_PROP_TAP_X_T2 14
#define GRAIL_PROP_TAP_Y_T2 15 #define GRAIL_PROP_TAP_Y_T2 15
#define GRAIL_PROP_TAP_ID_T3 16 #define GRAIL_PROP_TAP_ID_T3 16
#define GRAIL_PROP_TAP_X_T3 17 #define GRAIL_PROP_TAP_X_T3 17
#define GRAIL_PROP_TAP_Y_T3 18 #define GRAIL_PROP_TAP_Y_T3 18
#define GRAIL_PROP_TAP_ID_T4 19 #define GRAIL_PROP_TAP_ID_T4 19
#define GRAIL_PROP_TAP_X_T4 20 #define GRAIL_PROP_TAP_X_T4 20
#define GRAIL_PROP_TAP_Y_T4 21 #define GRAIL_PROP_TAP_Y_T4 21
#define GRAIL_PROP_TOUCH_X1 0 /* bounding box x1 */
#define GRAIL_PROP_TOUCH_Y1 1 /* bounding box y1 */
#define GRAIL_PROP_TOUCH_X2 2 /* bounding box x2 */
#define GRAIL_PROP_TOUCH_Y2 3 /* bounding box y2 */
#define GRAIL_PROP_TOUCH_ID_T0 4 /* first touch id */
#define GRAIL_PROP_TOUCH_X_T0 5 /* first touch horizontal position *
/
#define GRAIL_PROP_TOUCH_Y_T0 6 /* first touch vertical position */
#define GRAIL_PROP_TOUCH_ID_T1 7
#define GRAIL_PROP_TOUCH_X_T1 8
#define GRAIL_PROP_TOUCH_Y_T1 9
#define GRAIL_PROP_TOUCH_ID_T2 10
#define GRAIL_PROP_TOUCH_X_T2 11
#define GRAIL_PROP_TOUCH_Y_T2 12
#define GRAIL_PROP_TOUCH_ID_T3 13
#define GRAIL_PROP_TOUCH_X_T3 14
#define GRAIL_PROP_TOUCH_Y_T3 15
#define GRAIL_PROP_TOUCH_ID_T4 16
#define GRAIL_PROP_TOUCH_X_T4 17
#define GRAIL_PROP_TOUCH_Y_T4 18
#endif #endif
 End of changes. 7 change blocks. 
44 lines changed or deleted 77 lines changed or added


 grail.h   grail.h 
/************************************************************************** *** /************************************************************************** ***
* *
* grail - Gesture Recognition And Instantiation Library * grail - Gesture Recognition And Instantiation Library
* *
* Copyright (C) 2010 Canonical Ltd. * Copyright (C) 2010-2011 Canonical Ltd.
* Copyright (C) 2010 Henrik Rydberg <rydberg@bitmath.org>
* *
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the * under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your * Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. * option) any later version.
* *
* This program is distributed in the hope that it will be useful, but * This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of * WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details. * General Public License for more details.
* *
* You should have received a copy of the GNU General Public License along * You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>. * with this program. If not, see <http://www.gnu.org/licenses/>.
* *
************************************************************************** **/ ************************************************************************** **/
#ifndef _GRAIL_H #ifndef GRAIL_H
#define _GRAIL_H #define GRAIL_H
#include <linux/input.h>
#include <grail-bits.h> #include <grail-bits.h>
#include <grail-types.h> #include <grail-types.h>
#include <linux/input.h> #include <utouch/frame.h>
#ifdef __cplusplus
extern "C" {
#endif
#define GRAIL_VERSION 0x00011000
#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 32 #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; /* gesture properties */ #define GRAIL_EXPECT_DRAG_X 0x0001
typedef __u64 grail_time_t; /* time in milliseconds */ #define GRAIL_EXPECT_DRAG_Y 0x0002
#define GRAIL_EXPECT_SCALE 0x0004
#define GRAIL_EXPECT_ANGLE 0x0008
#define GRAIL_EXPECT_MASK 0x000f
typedef float grail_prop_t; /* gesture properties */
typedef utouch_frame_time_t grail_time_t; /* time in milliseconds */
typedef struct grail *grail_handle; /* the grail instance handle
*/
/**
* struct grail_get_version - get grail library version
*
* Report the version of the grail library, which can be different from
* the value of GRAIL_VERSION in this header file.
*
* This function allows for fallback options from major interface
* extensions within the same ABI version. For the normal cases of ABI
* agnostic or backwards incompatible changes, this function is not
* needed.
*/
unsigned int GRAIL_PUBLIC grail_get_version(void);
/** /**
* struct grail_coord - coordinate in bounding box units * struct grail_coord - coordinate in bounding box units
* @x: the horizontal position (bbox units) * @x: the horizontal position (bbox units)
* @y: the vertical position (bbox units) * @y: the vertical position (bbox units)
*/ */
struct grail_coord { struct grail_coord {
float x, y; float x, y;
}; };
grail_handle GRAIL_PUBLIC grail_new_raw(utouch_frame_handle fh,
unsigned int num_frames,
void *select,
unsigned int version,
unsigned int control_size,
unsigned int frame_size,
unsigned int slot_size);
/** /**
* struct grail_contact - MT event information in bounding box units * grail_new - allocate and initialize a new grail instance
* @id: Contact tracking id * @fh: utouch frame handle to use
* @tool_type: Tool type (ABS_MT_TOOL_TYPE) * @num_frames: number of frames in cyclic buffer
* @pos: Position of contact (bbox units) * @select: client selection callback
* @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 * Initialize the internal grail structures.
* the listed properties may be computed. *
* Returns zero in case of failure.
*/ */
struct grail_contact { #define grail_new(fh, num_frames, select) \
int id; grail_new_raw(fh, num_frames, select, \
int tool_type; GRAIL_VERSION, \
struct grail_coord pos; sizeof(struct grail_control), \
float touch_major; sizeof(struct grail_frame), \
float touch_minor; sizeof(struct grail_element))
float width_major;
float width_minor; /**
float angle; * grail_delete - destroy and delete grail instance
float pressure; * @ge: grail instance in use
}; *
* Deallocates all internal memory structures.
*/
void GRAIL_PUBLIC grail_delete(grail_handle ge);
/**
* grail_get_control - get mutable control structure
* @ge: the grail device in use
*
* Return the control struct of the grail instance.
*
* The control pointer is ABI agnostic, owned by the grail instance, and
* has grail scope.
*/
struct grail_control GRAIL_PUBLIC *grail_get_control(grail_handle ge);
/**
* grail_pump_frame - insert touch frames into grail
* @ge: the grail device in use
* @frame: the touch frame to insert
*
* Insert a new touch frame into the grail engine. If the frame induces a
* new gesture frame, a pointer to the frame is returned.
*
* The grail frame pointer is ABI agnostic, owned by the grail instance, an
d
* has grail scope.
*/
const struct grail_frame GRAIL_PUBLIC *
grail_pump_frame(grail_handle ge, const struct utouch_frame *frame);
/** /**
* struct grail_client_id - Gesture client information * struct grail_client_id - Gesture client information
* @client: Client id * @client: Client id
* @root: Root window * @root: Root window
* @event: Window to route events to * @event: Window to route events to
* @child: Window the event occured in * @child: Window the event occured in
* *
* This struct is treated opaquely, and only has meaning to the gesture * This struct is treated opaquely, and only has meaning to the gesture
* client. Details are subject to change. * client. Details are subject to change.
skipping to change at line 105 skipping to change at line 162
* struct grail_client_info - Gesture request information * struct grail_client_info - Gesture request information
* @id: Gesture client id * @id: Gesture client id
* @mask: Gestures the client is listening to * @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_control - control parameters of grail
* @glue_ms: minimum time to hold activation (ms)
* @bar_drag_x: horizontal distance to activate (surface width fraction)
* @bar_drag_y: vertical distance to activate (surface height fraction)
* @bar_scale: minimum scaling to activate (fraction)
* @bar_angle: minimum angle to activate (radians)
* @drop_x_ms: horizontal expect timeout (ms)
* @drop_y_ms: vertical expect timeout (ms)
* @drop_scale_ms: scaling expect timeout (ms)
* @drop_angle_ms: rotation expect timeout (ms)
*
* The parameters are used to tune the behavior of the gesture recognition.
*
* The moveness is a number between zero and one denoting the
* character of the current transform. Zero means pure rotate and
* scale, one means pure drag.
*
* Later versions of this struct may grow in size, but will remain
* binary compatible with older versions.
*/
struct grail_control {
float glue_ms;
float bar_drag_x;
float bar_drag_y;
float bar_scale;
float bar_angle;
float drop_x_ms;
float drop_y_ms;
float drop_scale_ms;
float drop_angle_ms;
};
/**
* struct grail_frame - frame of ongoing elementary transformations
* @prev: pointer to the previous gesture frame
* @touch: pointer to the touch frame triggering this gesture frame
* @num_ongoing: number of elements in the ongoing array
* @ongoing: array of ongoing transformation elements
* @slots: array of all transformation slots
*
* A gesture frame consists of one or several touch frames glued
* together into a stable transition, combined with information on
* ongoing elementary gestural transformations. The array of ongoing
* elements contains all elements with a nonzero expect mask.
*
* Later versions of this struct may grow in size, but will remain
* binary compatible with older versions.
*/
struct grail_frame {
const struct grail_frame *prev;
const struct utouch_frame *touch;
unsigned int num_ongoing;
struct grail_element **ongoing;
struct grail_element **slots;
};
/**
* struct grail_element - elementary gesture transformation
* @prev: respective element of previous frame
* @slot: the transformation slot occupied by this element
* @id: unique identifier of the ongoing transformation
* @num_touches: number of contacts of this element
* @touches: array of contacts of this element
* @start_time: start time of this element
* @expect_mask: bitmask of expected gestures (grail main types)
* @active_mask: bitmask of activated gestures (grail main types)
* @center: gesture center position (surface units)
* @velocity: current center velocity (surface units per second)
* @radius: gesture radius from center (surface units)
* @transform: the transformation matrix of the gesture
* @rotation_center: current instant center of rotation (surface units)
* @drag: accumulated transformation displacement (surface units)
* @scale: accumulated scale (dimensionless)
* @angle: accumulated rotation angle (radians)
*
* The grail element describes the ongoing gestural transformation of
* a particular set of contacts. The expect mask describes which
* gestural transformations may become active during the course of
* events, and the active mask describes which have passed their
* respective activation threshold. The set of expected gestures can
* change over time, for instance by exclusion or timeout.
*
* Applications handling rotation, either by transformation matrix or
* angle, should use the drag displacement. For other applications,
* the center displacement may be used instead, as to not lose
* movement accuracy.
*
* Later versions of this struct may grow in size, but will remain
* binary compatible with older versions.
*/
struct grail_element {
const struct grail_element *prev;
int slot;
int id;
int num_touches;
const struct utouch_contact **touches;
grail_time_t start_time;
unsigned int expect_mask;
unsigned int active_mask;
struct grail_coord center;
struct grail_coord velocity;
float radius2;
float transform[6];
struct grail_coord rotation_center;
struct grail_coord drag;
float scale2;
float angle;
};
/**
* grail_element_transform - transform coordinates using element
* @slot: the transformation element to use
* @q: the grail coordinate to fill
* @x: the grail coordinate to transform
*
* Performs the 3x3 transform *q = T *p, where T is the element
* transform.
*/
static inline void grail_element_transform(const struct grail_element *slot
,
struct grail_coord *q,
const struct grail_coord *p)
{
const float *T = slot->transform;
q->x = T[0] * (p->x - slot->center.x) +
T[1] * (p->y - slot->center.y) +
T[2] + slot->center.x;
q->y = T[3] * (p->x - slot->center.x) +
T[4] * (p->y - slot->center.y) +
T[5] + slot->center.y;
}
/**
* struct grail_event - Gesture event * struct grail_event - Gesture event
* @type: The gesture type * @type: The gesture type
* @id: Unique identifier foof the gesture instance * @id: Unique identifier foof the gesture instance
* @status: Gesture status (begin, update, end) * @status: Gesture status (begin, update, end)
* @ntouch: Number of current touches * @ntouch: Number of current touches
* @nprop: Number of properties in the gesture * @nprop: Number of properties in the gesture
* @pos: Focus point of the gesture (bbox coordinates) * @pos: Focus point of the gesture (bbox coordinates)
* @touch: Array of individual touch information * @touch: Array of individual touch information
* @client_id: The gesture client to route the gesture to * @client_id: The gesture client to route the gesture to
* @time: Time of event (milliseconds) * @time: Time of event (milliseconds)
skipping to change at line 178 skipping to change at line 367
* @fd: file descriptor of the kernel device * @fd: file descriptor of the kernel device
* *
* Initialize the internal grail structures and configure it by reading the * Initialize the internal grail structures and configure it by reading the
* protocol capabilities through the file descriptor. * protocol capabilities through the file descriptor.
* *
* The callbacks, parameters and priv pointer should be set prior to this * The callbacks, parameters and priv pointer should be set prior to this
* call. * call.
* *
* Returns zero on success, negative error number otherwise. * Returns zero on success, negative error number otherwise.
*/ */
int grail_open(struct grail *ge, int fd); int GRAIL_PUBLIC grail_open(struct grail *ge, int fd);
/** /**
* grail_idle - check state of kernel device * grail_idle - check state of kernel device
* @ge: the grail device in use * @ge: the grail device in use
* @fd: file descriptor of the kernel device * @fd: file descriptor of the kernel device
* @ms: number of milliseconds to wait for activity * @ms: number of milliseconds to wait for activity
* *
* Returns true if the device is idle, i.e., there are no fetched * 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. * 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_PUBLIC grail_idle(struct grail *ge, int fd, int ms);
/** /**
* grail_pull - pull and process available events from the kernel device * grail_pull - pull and process available events from the kernel device
* @ge: the grail device in use * @ge: the grail device in use
* @fd: file descriptor of the kernel device * @fd: file descriptor of the kernel device
* *
* Pull all available events and process them. The grail callbacks are * Pull all available events and process them. The grail callbacks are
* invoked during this call. * invoked during this call.
* *
* The underlying file descriptor must have O_NONBLOCK set, or this method * The underlying file descriptor must have O_NONBLOCK set, or this method
* will not return until the file is closed. * will not return until the file is closed.
* *
* On success, returns the number of events read. Otherwise, * On success, returns the number of events read. Otherwise,
* a standard negative error number is returned. * a standard negative error number is returned.
*/ */
int grail_pull(struct grail *ge, int fd); int GRAIL_PUBLIC grail_pull(struct grail *ge, int fd);
/** /**
* grail_close - close the grail device * grail_close - close the grail device
* @ge: the grail device to close * @ge: the grail device to close
* @fd: file descriptor of the kernel device * @fd: file descriptor of the kernel device
* *
* Deallocates all memory associated with grail, and clears the grail * Deallocates all memory associated with grail, and clears the grail
* structure. * structure.
*/ */
void grail_close(struct grail *ge, int fd); void GRAIL_PUBLIC grail_close(struct grail *ge, int fd);
/** /**
* grail_set_bbox - set the grail unit bounding box * grail_set_bbox - set the grail unit bounding box
* @ge: the grail device in use * @ge: the grail device in use
* @min: the minimum (lower-left) corner of the bounding box * @min: the minimum (lower-left) corner of the bounding box
* @max: the maximum (upper-right) 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. * Sets the box within which the device coordinates should be presented.
*/ */
void grail_set_bbox(struct grail *ge, void GRAIL_PUBLIC 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 * grail_get_units - get device coordinate ranges
* @ge: the grail device in use * @ge: the grail device in use
* @min: minimum x and y coordinates * @min: minimum x and y coordinates
* @max: maximum x and y coordinates * @max: maximum x and y coordinates
* *
* The grail event attributes pos, touch_major, touch_minor, * The grail event attributes pos, touch_major, touch_minor,
* width_major, and width_minor are all given in device coordinate * width_major, and width_minor are all given in device coordinate
* units, unless specified otherwise using the grail_set_bbox() * units, unless specified otherwise using the grail_set_bbox()
* function. This function reports the device coordinate ranges. * function. This function reports the device coordinate ranges.
* *
*/ */
void grail_get_units(const struct grail *ge, void GRAIL_PUBLIC grail_get_units(const struct grail *ge,
struct grail_coord *min, struct grail_coord *max); struct grail_coord *min, struct grail_coor
d *max);
/** /**
* grail_get_contacts - get current contact state * grail_get_contact_frame - get current contact frame
* @ge: the grail device in use * @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. * Return the contact frame current being processed. If called from
* within a gesture callback, it is guaranteed to return the frame
* corresponding to the gesture.
* *
* The returned pointer can be NULL if no input has yet been extracted
* through the grail instance.
*
* The frame pointer is ABI agnostic, owned by the grail instance, and
* has grail scope.
*/ */
int grail_get_contacts(const struct grail *ge, const struct utouch_frame GRAIL_PUBLIC *
struct grail_contact *touch, int max_touch); grail_get_contact_frame(const struct grail *ge);
#ifndef GRAIL_NO_LEGACY_API
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;
};
void GRAIL_PUBLIC grail_filter_abs_events(struct grail *ge, int usage);
int GRAIL_PUBLIC grail_get_contacts(const struct grail *ge,
struct grail_contact *touch, int max_tou
ch);
#endif
#ifdef __cplusplus
}
#endif
#endif #endif
 End of changes. 21 change blocks. 
58 lines changed or deleted 269 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/