diff options
Diffstat (limited to 'include/grail.h')
| -rw-r--r-- | include/grail.h | 52 |
1 files changed, 17 insertions, 35 deletions
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 @@ | |||
| 25 | #ifndef _GRAIL_H | 25 | #ifndef _GRAIL_H |
| 26 | #define _GRAIL_H | 26 | #define _GRAIL_H |
| 27 | 27 | ||
| 28 | #include <grail-bits.h> | ||
| 28 | #include <linux/input.h> | 29 | #include <linux/input.h> |
| 29 | 30 | ||
| 30 | #define GRAIL_STATUS_BEGIN 0 | ||
| 31 | #define GRAIL_STATUS_UPDATE 1 | ||
| 32 | #define GRAIL_STATUS_END 2 | ||
| 33 | |||
| 34 | #define DIM_GRAIL_TYPE 64 | 31 | #define DIM_GRAIL_TYPE 64 |
| 35 | #define DIM_GRAIL_TYPE_BYTES (DIM_GRAIL_TYPE >> 3) | 32 | #define DIM_GRAIL_TYPE_BYTES ((DIM_GRAIL_TYPE + 7) >> 3) |
| 36 | 33 | ||
| 37 | #define GRAIL_TYPE_MOVE 0 | 34 | #define DIM_GRAIL_PROP 16 |
| 38 | #define GRAIL_TYPE_VSCROLL 1 | 35 | #define DIM_GRAIL_PROP_BYTES ((DIM_GRAIL_PROP + 7) >> 3) |
| 39 | #define GRAIL_TYPE_HSCROLL 2 | ||
| 40 | #define GRAIL_TYPE_SCROLL 3 | ||
| 41 | 36 | ||
| 42 | #define DIM_GRAIL_PROP 8 | 37 | #define GRAIL_TYPE_MOVE 0 |
| 38 | #define GRAIL_TYPE_SCROLL 1 | ||
| 39 | #define GRAIL_TYPE_ZOOM 2 | ||
| 40 | #define GRAIL_TYPE_ROTATE 3 | ||
| 41 | #define GRAIL_TYPE_SZRCOMBO 4 | ||
| 43 | 42 | ||
| 44 | static const int GRAIL_NPROP[] = { | 43 | #define GRAIL_STATUS_BEGIN 0 |
| 45 | 2, /* MOVE */ | 44 | #define GRAIL_STATUS_UPDATE 1 |
| 46 | 1, /* VSCROLL */ | 45 | #define GRAIL_STATUS_END 2 |
| 47 | 1, /* HSCROLL */ | ||
| 48 | 2, /* SCROLL */ | ||
| 49 | }; | ||
| 50 | 46 | ||
| 51 | typedef unsigned char grail_mask_t; | 47 | typedef float grail_prop_t; |
| 52 | typedef int grail_prop_t; | ||
| 53 | typedef __u64 grail_time_t; | 48 | typedef __u64 grail_time_t; |
| 54 | 49 | ||
| 55 | static inline void grail_set_mask(grail_mask_t *mask, int i) | ||
| 56 | { | ||
| 57 | mask[i >> 3] |= (1 << (i & 7)); | ||
| 58 | } | ||
| 59 | |||
| 60 | static inline void grail_clear_mask(grail_mask_t *mask, int i) | ||
| 61 | { | ||
| 62 | mask[i >> 3] &= ~(1 << (i & 7)); | ||
| 63 | } | ||
| 64 | |||
| 65 | static inline int grail_get_mask(const grail_mask_t *mask, int i) | ||
| 66 | { | ||
| 67 | return (mask[i >> 3] >> (i & 7)) & 1; | ||
| 68 | } | ||
| 69 | |||
| 70 | struct grail_coord { | 50 | struct grail_coord { |
| 71 | int x, y; | 51 | float x, y; |
| 72 | }; | 52 | }; |
| 73 | 53 | ||
| 74 | struct grail_client_id { | 54 | struct grail_client_id { |
| @@ -85,6 +65,8 @@ struct grail_event { | |||
| 85 | int type; | 65 | int type; |
| 86 | int id; | 66 | int id; |
| 87 | int status; | 67 | int status; |
| 68 | int ntouch; | ||
| 69 | int nprop; | ||
| 88 | struct grail_coord pos; | 70 | struct grail_coord pos; |
| 89 | struct grail_client_id client_id; | 71 | struct grail_client_id client_id; |
| 90 | grail_time_t time; | 72 | grail_time_t time; |
| @@ -95,7 +77,7 @@ struct grail { | |||
| 95 | int (*get_clients)(struct grail *ge, | 77 | int (*get_clients)(struct grail *ge, |
| 96 | struct grail_client_info *client, int max_clients, | 78 | struct grail_client_info *client, int max_clients, |
| 97 | const struct grail_coord *coords, int num_coords, | 79 | const struct grail_coord *coords, int num_coords, |
| 98 | const grail_mask_t *types); | 80 | const grail_mask_t *types, int num_types); |
| 99 | void (*event)(struct grail *ge, | 81 | void (*event)(struct grail *ge, |
| 100 | const struct input_event *ev); | 82 | const struct input_event *ev); |
| 101 | void (*gesture)(struct grail *ge, | 83 | void (*gesture)(struct grail *ge, |
