summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@bitmath.org>2010-07-20 15:39:08 +0200
committerHenrik Rydberg <rydberg@euromail.se>2010-08-05 22:48:38 +0200
commiteb896e11aacab5f53e3915a8d19ffffd92ce8e10 (patch)
treea2b12258c1697e61854704a0eff14070bc9fa963 /src
parent3b9c20f869a2f55bd9953665c9e7fd713db4ff43 (diff)
Touch API changes
Add touch time to the touch frame (Thanks Rafi) Add touch change counters to the touch frame Add event bypass callback Signed-off-by: Henrik Rydberg <rydberg@bitmath.org>
Diffstat (limited to 'src')
-rw-r--r--src/touch-engine.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/src/touch-engine.c b/src/touch-engine.c
index a3830a9..6174e0d 100644
--- a/src/touch-engine.c
+++ b/src/touch-engine.c
@@ -27,6 +27,9 @@
27 27
28static void tp_event(struct touch_dev *dev, const struct input_event *ev) 28static void tp_event(struct touch_dev *dev, const struct input_event *ev)
29{ 29{
30 struct touch_engine *engine = dev->priv;
31 if (engine && engine->event)
32 engine->event(engine, ev);
30} 33}
31 34
32static void update_frame(struct touch_frame *frame, 35static void update_frame(struct touch_frame *frame,
@@ -43,7 +46,7 @@ static void update_frame(struct touch_frame *frame,
43 } 46 }
44} 47}
45 48
46static void finalize_frame(struct touch_frame *frame) 49static void finalize_frame(struct touch_frame *frame, touch_time_t time)
47{ 50{
48 int last = -1; 51 int last = -1;
49 frame->ntouch = 0; 52 frame->ntouch = 0;
@@ -59,47 +62,59 @@ static void finalize_frame(struct touch_frame *frame)
59 frame->ntouch++; 62 frame->ntouch++;
60 } 63 }
61 } 64 }
65 frame->time = time;
62} 66}
63 67
64static void tp_create(struct touch_dev *dev, int slot, 68static void tp_create(struct touch_dev *dev, int slot,
65 const touch_prop_mask_t *mask, const touch_prop_t *prop) 69 const touch_prop_mask_t *mask, const touch_prop_t *prop)
66{ 70{
67 struct touch_engine *engine = dev->priv; 71 struct touch_engine *engine = dev->priv;
68 if (engine) 72 if (engine) {
73 engine->frame.ncreate++;
69 update_frame(&engine->frame, slot, 1, mask, prop); 74 update_frame(&engine->frame, slot, 1, mask, prop);
75 }
70} 76}
71 77
72static void tp_modify(struct touch_dev *dev, int slot, 78static void tp_modify(struct touch_dev *dev, int slot,
73 const touch_prop_mask_t *mask, const touch_prop_t *prop) 79 const touch_prop_mask_t *mask, const touch_prop_t *prop)
74{ 80{
75 struct touch_engine *engine = dev->priv; 81 struct touch_engine *engine = dev->priv;
76 if (engine) 82 if (engine) {
83 engine->frame.nmodify++;
77 update_frame(&engine->frame, slot, 1, mask, prop); 84 update_frame(&engine->frame, slot, 1, mask, prop);
85 }
78} 86}
79 87
80static void tp_destroy(struct touch_dev *dev, int slot) 88static void tp_destroy(struct touch_dev *dev, int slot)
81{ 89{
82 struct touch_engine *engine = dev->priv; 90 struct touch_engine *engine = dev->priv;
83 if (engine) 91 if (engine) {
92 engine->frame.ndestroy++;
84 update_frame(&engine->frame, slot, 0, 0, 0); 93 update_frame(&engine->frame, slot, 0, 0, 0);
94 }
85} 95}
86 96
87static void tp_sync(struct touch_dev *dev, touch_time_t time) 97static void tp_sync(struct touch_dev *dev, touch_time_t time)
88{ 98{
89 struct touch_engine *engine = dev->priv; 99 struct touch_engine *engine = dev->priv;
90 if (engine) { 100 if (engine) {
91 finalize_frame(&engine->frame); 101 finalize_frame(&engine->frame, time);
92 if (engine->sync) 102 if (engine->sync)
93 engine->sync(engine, time); 103 engine->sync(engine);
104 engine->frame.ncreate = 0;
105 engine->frame.nmodify = 0;
106 engine->frame.ndestroy = 0;
94 } 107 }
95} 108}
96 109
97void touch_engine_init(struct touch_engine *engine, 110void touch_engine_init(struct touch_engine *engine,
98 void (*sync)(struct touch_engine *engine, 111 void (*event)(struct touch_engine *engine,
99 touch_time_t time), 112 const struct input_event *ev),
113 void (*sync)(struct touch_engine *engine),
100 void *priv) 114 void *priv)
101{ 115{
102 memset(engine, 0, sizeof(*engine)); 116 memset(engine, 0, sizeof(*engine));
117 engine->event = event;
103 engine->sync = sync; 118 engine->sync = sync;
104 engine->priv = priv; 119 engine->priv = priv;
105} 120}