From d07c43f9f19dc0ee38aaf44947cfc396f437490e Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Tue, 3 Aug 2010 15:01:50 +0200 Subject: Introduce zoom, rotate and combo gestures Introduce grail_mask bit functions, and add new gestures as separate functions, referring to the same move model. Signed-off-by: Henrik Rydberg --- include/grail.h | 52 +++++++++++++++++----------------------------------- 1 file changed, 17 insertions(+), 35 deletions(-) (limited to 'include/grail.h') diff --git a/include/grail.h b/include/grail.h index de202b5..0570101 100644 --- a/include/grail.h +++ b/include/grail.h @@ -25,50 +25,30 @@ #ifndef _GRAIL_H #define _GRAIL_H +#include #include -#define GRAIL_STATUS_BEGIN 0 -#define GRAIL_STATUS_UPDATE 1 -#define GRAIL_STATUS_END 2 - #define DIM_GRAIL_TYPE 64 -#define DIM_GRAIL_TYPE_BYTES (DIM_GRAIL_TYPE >> 3) +#define DIM_GRAIL_TYPE_BYTES ((DIM_GRAIL_TYPE + 7) >> 3) -#define GRAIL_TYPE_MOVE 0 -#define GRAIL_TYPE_VSCROLL 1 -#define GRAIL_TYPE_HSCROLL 2 -#define GRAIL_TYPE_SCROLL 3 +#define DIM_GRAIL_PROP 16 +#define DIM_GRAIL_PROP_BYTES ((DIM_GRAIL_PROP + 7) >> 3) -#define DIM_GRAIL_PROP 8 +#define GRAIL_TYPE_MOVE 0 +#define GRAIL_TYPE_SCROLL 1 +#define GRAIL_TYPE_ZOOM 2 +#define GRAIL_TYPE_ROTATE 3 +#define GRAIL_TYPE_SZRCOMBO 4 -static const int GRAIL_NPROP[] = { - 2, /* MOVE */ - 1, /* VSCROLL */ - 1, /* HSCROLL */ - 2, /* SCROLL */ -}; +#define GRAIL_STATUS_BEGIN 0 +#define GRAIL_STATUS_UPDATE 1 +#define GRAIL_STATUS_END 2 -typedef unsigned char grail_mask_t; -typedef int grail_prop_t; +typedef float grail_prop_t; typedef __u64 grail_time_t; -static inline void grail_set_mask(grail_mask_t *mask, int i) -{ - mask[i >> 3] |= (1 << (i & 7)); -} - -static inline void grail_clear_mask(grail_mask_t *mask, int i) -{ - mask[i >> 3] &= ~(1 << (i & 7)); -} - -static inline int grail_get_mask(const grail_mask_t *mask, int i) -{ - return (mask[i >> 3] >> (i & 7)) & 1; -} - struct grail_coord { - int x, y; + float x, y; }; struct grail_client_id { @@ -85,6 +65,8 @@ struct grail_event { int type; int id; int status; + int ntouch; + int nprop; struct grail_coord pos; struct grail_client_id client_id; grail_time_t time; @@ -95,7 +77,7 @@ struct grail { int (*get_clients)(struct grail *ge, struct grail_client_info *client, int max_clients, const struct grail_coord *coords, int num_coords, - const grail_mask_t *types); + const grail_mask_t *types, int num_types); void (*event)(struct grail *ge, const struct input_event *ev); void (*gesture)(struct grail *ge, -- cgit v1.2.3