From eb896e11aacab5f53e3915a8d19ffffd92ce8e10 Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Tue, 20 Jul 2010 15:39:08 +0200 Subject: 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 --- src/touch-engine.c | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) (limited to 'src/touch-engine.c') 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 @@ static void tp_event(struct touch_dev *dev, const struct input_event *ev) { + struct touch_engine *engine = dev->priv; + if (engine && engine->event) + engine->event(engine, ev); } static void update_frame(struct touch_frame *frame, @@ -43,7 +46,7 @@ static void update_frame(struct touch_frame *frame, } } -static void finalize_frame(struct touch_frame *frame) +static void finalize_frame(struct touch_frame *frame, touch_time_t time) { int last = -1; frame->ntouch = 0; @@ -59,47 +62,59 @@ static void finalize_frame(struct touch_frame *frame) frame->ntouch++; } } + frame->time = time; } static void tp_create(struct touch_dev *dev, int slot, const touch_prop_mask_t *mask, const touch_prop_t *prop) { struct touch_engine *engine = dev->priv; - if (engine) + if (engine) { + engine->frame.ncreate++; update_frame(&engine->frame, slot, 1, mask, prop); + } } static void tp_modify(struct touch_dev *dev, int slot, const touch_prop_mask_t *mask, const touch_prop_t *prop) { struct touch_engine *engine = dev->priv; - if (engine) + if (engine) { + engine->frame.nmodify++; update_frame(&engine->frame, slot, 1, mask, prop); + } } static void tp_destroy(struct touch_dev *dev, int slot) { struct touch_engine *engine = dev->priv; - if (engine) + if (engine) { + engine->frame.ndestroy++; update_frame(&engine->frame, slot, 0, 0, 0); + } } static void tp_sync(struct touch_dev *dev, touch_time_t time) { struct touch_engine *engine = dev->priv; if (engine) { - finalize_frame(&engine->frame); + finalize_frame(&engine->frame, time); if (engine->sync) - engine->sync(engine, time); + engine->sync(engine); + engine->frame.ncreate = 0; + engine->frame.nmodify = 0; + engine->frame.ndestroy = 0; } } void touch_engine_init(struct touch_engine *engine, - void (*sync)(struct touch_engine *engine, - touch_time_t time), + void (*event)(struct touch_engine *engine, + const struct input_event *ev), + void (*sync)(struct touch_engine *engine), void *priv) { memset(engine, 0, sizeof(*engine)); + engine->event = event; engine->sync = sync; engine->priv = priv; } -- cgit v1.2.3