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 --- test/grail.c | 11 ++++++++--- test/touch.c | 12 +++++++++--- 2 files changed, 17 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/grail.c b/test/grail.c index 3fe20ee..82de65f 100644 --- a/test/grail.c +++ b/test/grail.c @@ -128,11 +128,16 @@ static void gh_destroy(struct gesture_handler *gh) gedev_destroy(&gh->dev); } -static void tp_sync(struct touch_engine *engine, touch_time_t time) +static void tp_event(struct touch_engine *engine, + const struct input_event *ev) +{ +} + +static void tp_sync(struct touch_engine *engine) { struct gesture_handler *gh = engine->priv; struct touch_frame *frame = &engine->frame; - gh_handle(gh, frame, time); + gh_handle(gh, frame, frame->time); } static void loop_device(struct touch_dev *dev, int fd) @@ -140,7 +145,7 @@ static void loop_device(struct touch_dev *dev, int fd) struct gesture_handler gh; struct touch_engine engine; gh_init(&gh); - touch_engine_init(&engine, tp_sync, &gh); + touch_engine_init(&engine, tp_event, tp_sync, &gh); touch_engine_attach(&engine, dev); while (!touch_dev_idle(dev, fd, 5000)) touch_dev_pull(dev, fd); diff --git a/test/touch.c b/test/touch.c index 48b2f12..1f9213d 100644 --- a/test/touch.c +++ b/test/touch.c @@ -28,11 +28,17 @@ #include #include -static void tp_sync(struct touch_engine *engine, touch_time_t time) +static void tp_event(struct touch_engine *engine, + const struct input_event *ev) +{ + fprintf(stderr, "event %d %d %d\n", ev->type, ev->code, ev->value); +} + +static void tp_sync(struct touch_engine *engine) { struct touch_frame *frame = &engine->frame; int slot, i; - fprintf(stderr, "sync %d %lld\n", frame->ntouch, time); + fprintf(stderr, "sync %d %lld\n", frame->ntouch, frame->time); for (slot = frame->slot; slot >= 0; slot = next_slot(frame, slot)) { struct touch *touch = &frame->touch[slot]; fprintf(stderr, "touch %d\n", slot); @@ -44,7 +50,7 @@ static void tp_sync(struct touch_engine *engine, touch_time_t time) static void loop_device(struct touch_dev *dev, int fd) { struct touch_engine engine; - touch_engine_init(&engine, tp_sync, 0); + touch_engine_init(&engine, tp_event, tp_sync, 0); touch_engine_attach(&engine, dev); while (!touch_dev_idle(dev, fd, 5000)) touch_dev_pull(dev, fd); -- cgit v1.2.3