summaryrefslogtreecommitdiff
path: root/include/grail-touch.h
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@bitmath.org>2010-08-03 15:01:50 +0200
committerHenrik Rydberg <rydberg@euromail.se>2010-08-05 22:48:38 +0200
commitd07c43f9f19dc0ee38aaf44947cfc396f437490e (patch)
tree2f9af561594a1de5553ba85b69b50bee421d5507 /include/grail-touch.h
parent342a43e7b2ceec1dd200bffa24b052fec33f5bdc (diff)
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 <rydberg@bitmath.org>
Diffstat (limited to 'include/grail-touch.h')
-rw-r--r--include/grail-touch.h35
1 files changed, 17 insertions, 18 deletions
diff --git a/include/grail-touch.h b/include/grail-touch.h
index e07ffca..5bf0034 100644
--- a/include/grail-touch.h
+++ b/include/grail-touch.h
@@ -25,12 +25,13 @@
25#ifndef _GRAIL_TOUCH_H 25#ifndef _GRAIL_TOUCH_H
26#define _GRAIL_TOUCH_H 26#define _GRAIL_TOUCH_H
27 27
28#include <grail-bits.h>
28#include <mtdev.h> 29#include <mtdev.h>
29 30
30#define DIM_TOUCHES 32 31#define DIM_TOUCH 32
32#define DIM_TOUCH_BYTES ((DIM_TOUCH + 7) >> 3)
31 33
32typedef int touch_prop_t; 34typedef int touch_prop_t;
33typedef unsigned touch_prop_mask_t;
34typedef __u64 touch_time_t; 35typedef __u64 touch_time_t;
35 36
36enum touch_prop_list { 37enum touch_prop_list {
@@ -45,29 +46,37 @@ enum touch_prop_list {
45 DIM_TOUCH_PROP 46 DIM_TOUCH_PROP
46}; 47};
47 48
49#define DIM_TOUCH_PROP_BYTES ((DIM_TOUCH_PROP + 7) >> 3)
50
48struct touch { 51struct touch {
49 int active; 52 int active;
50 int slot; 53 int slot;
51 int next;
52 touch_prop_t prop[DIM_TOUCH_PROP]; 54 touch_prop_t prop[DIM_TOUCH_PROP];
53}; 55};
54 56
55struct touch_frame { 57struct touch_frame {
56 int ntouch; 58 int nactive;
57 int slot;
58 int ncreate, nmodify, ndestroy; 59 int ncreate, nmodify, ndestroy;
59 touch_time_t time; 60 touch_time_t time;
60 struct touch touch[DIM_TOUCHES]; 61 grail_mask_t touches[DIM_TOUCH_BYTES];
62 struct touch *active[DIM_TOUCH];
63 struct touch touch[DIM_TOUCH];
64};
65
66struct touch_dev_caps {
67 grail_mask_t mask[DIM_TOUCH_PROP_BYTES];
68 struct input_absinfo info[DIM_TOUCH_PROP];
61}; 69};
62 70
63struct touch_dev { 71struct touch_dev {
64 void (*event)(struct touch_dev *dev, const struct input_event *ev); 72 void (*event)(struct touch_dev *dev, const struct input_event *ev);
65 void (*create)(struct touch_dev *dev, int slot, 73 void (*create)(struct touch_dev *dev, int slot,
66 const touch_prop_mask_t *mask, const touch_prop_t *prop); 74 const grail_mask_t *mask, const touch_prop_t *prop);
67 void (*modify)(struct touch_dev *dev, int slot, 75 void (*modify)(struct touch_dev *dev, int slot,
68 const touch_prop_mask_t *mask, const touch_prop_t *prop); 76 const grail_mask_t *mask, const touch_prop_t *prop);
69 void (*destroy)(struct touch_dev *dev, int slot); 77 void (*destroy)(struct touch_dev *dev, int slot);
70 void (*sync)(struct touch_dev *dev, const struct input_event *syn); 78 void (*sync)(struct touch_dev *dev, const struct input_event *syn);
79 struct touch_dev_caps caps;
71 struct touch_dev_impl *impl; 80 struct touch_dev_impl *impl;
72 void *priv; 81 void *priv;
73}; 82};
@@ -81,16 +90,6 @@ struct touch_engine {
81 void *priv; 90 void *priv;
82}; 91};
83 92
84static inline int has_prop(const touch_prop_mask_t *mask, int code)
85{
86 return (mask[code >> 5] >> (code & 31)) & 1;
87}
88
89static inline int next_slot(const struct touch_frame *frame, int slot)
90{
91 return frame->touch[slot].next;
92}
93
94int touch_dev_open(struct touch_dev *dev, int fd); 93int touch_dev_open(struct touch_dev *dev, int fd);
95int touch_dev_idle(struct touch_dev *dev, int fd, int ms); 94int touch_dev_idle(struct touch_dev *dev, int fd, int ms);
96int touch_dev_fetch(struct touch_dev *dev, int fd); 95int touch_dev_fetch(struct touch_dev *dev, int fd);