summaryrefslogtreecommitdiff
path: root/src/touch-engine.c
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 /src/touch-engine.c
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 'src/touch-engine.c')
-rw-r--r--src/touch-engine.c42
1 files changed, 17 insertions, 25 deletions
diff --git a/src/touch-engine.c b/src/touch-engine.c
index 28b68da..3e6870e 100644
--- a/src/touch-engine.c
+++ b/src/touch-engine.c
@@ -34,40 +34,29 @@ static void tp_event(struct touch_dev *dev, const struct input_event *ev)
34 34
35static void update_frame(struct touch_frame *frame, 35static void update_frame(struct touch_frame *frame,
36 int slot, int active, 36 int slot, int active,
37 const touch_prop_mask_t *mask, 37 const grail_mask_t *mask,
38 const touch_prop_t *prop) 38 const touch_prop_t *prop)
39{ 39{
40 struct touch *touch = &frame->touch[slot]; 40 struct touch *t = &frame->touch[slot];
41 touch->active = active; 41 int i;
42 if (mask && prop) { 42 t->active = active;
43 int i; 43 grail_mask_modify(frame->touches, slot, active);
44 for (i = 0; i < DIM_TOUCH_PROP; i++) 44 if (mask && prop)
45 if (has_prop(mask, i)) 45 grail_mask_foreach(i, mask, DIM_TOUCH_PROP_BYTES)
46 touch->prop[i] = prop[i]; 46 t->prop[i] = prop[i];
47 }
48} 47}
49 48
50static void finalize_frame(struct touch_frame *frame, touch_time_t time) 49static void finalize_frame(struct touch_frame *frame, touch_time_t time)
51{ 50{
52 int i, last = -1; 51 int i, nslot = 0;
53 frame->ntouch = 0; 52 grail_mask_foreach(i, frame->touches, DIM_TOUCH_BYTES)
54 frame->slot = -1; 53 frame->active[nslot++] = &frame->touch[i];
55 for (i = 0; i < DIM_TOUCH_PROP; i++) { 54 frame->nactive = nslot;
56 frame->touch[i].next = -1;
57 if (frame->touch[i].active) {
58 if (last < 0)
59 frame->slot = i;
60 else
61 frame->touch[last].next = i;
62 last = i;
63 frame->ntouch++;
64 }
65 }
66 frame->time = time; 55 frame->time = time;
67} 56}
68 57
69static void tp_create(struct touch_dev *dev, int slot, 58static void tp_create(struct touch_dev *dev, int slot,
70 const touch_prop_mask_t *mask, const touch_prop_t *prop) 59 const grail_mask_t *mask, const touch_prop_t *prop)
71{ 60{
72 struct touch_engine *engine = dev->priv; 61 struct touch_engine *engine = dev->priv;
73 if (engine) { 62 if (engine) {
@@ -77,7 +66,7 @@ static void tp_create(struct touch_dev *dev, int slot,
77} 66}
78 67
79static void tp_modify(struct touch_dev *dev, int slot, 68static void tp_modify(struct touch_dev *dev, int slot,
80 const touch_prop_mask_t *mask, const touch_prop_t *prop) 69 const grail_mask_t *mask, const touch_prop_t *prop)
81{ 70{
82 struct touch_engine *engine = dev->priv; 71 struct touch_engine *engine = dev->priv;
83 if (engine) { 72 if (engine) {
@@ -117,7 +106,10 @@ void touch_engine_init(struct touch_engine *engine,
117 const struct input_event *ev), 106 const struct input_event *ev),
118 void *priv) 107 void *priv)
119{ 108{
109 int i;
120 memset(engine, 0, sizeof(*engine)); 110 memset(engine, 0, sizeof(*engine));
111 for (i = 0; i < DIM_TOUCH; i++)
112 engine->frame.touch[i].slot = i;
121 engine->event = event; 113 engine->event = event;
122 engine->sync = sync; 114 engine->sync = sync;
123 engine->priv = priv; 115 engine->priv = priv;