From 8bbf06f8d0056ae30fdfaf260000e763fad2345c Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Thu, 5 Aug 2010 15:26:16 +0200 Subject: make event units public in the api Add grail_get_units() to the api, so so that applications can extract the min/max coordinates used in the gesture events. Signed-off-by: Henrik Rydberg --- src/grail-api.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/grail-api.c') diff --git a/src/grail-api.c b/src/grail-api.c index c4a88df..2c6c438 100644 --- a/src/grail-api.c +++ b/src/grail-api.c @@ -95,13 +95,14 @@ int grail_open(struct grail *ge, int fd) x = calloc(1, sizeof(*x)); if (!x) return -ENOMEM; + ge->impl = x; ret = gin_init(ge); if (ret) goto freemem; ret = touch_dev_open(&x->dev, fd); if (ret) goto freegin; - ret = gru_init(ge, &x->dev.caps); + ret = gru_init(ge); if (ret) goto freedev; x->fd = fd; @@ -110,7 +111,6 @@ int grail_open(struct grail *ge, int fd) ret = pthread_create(&x->thread, NULL, grail_thread, x); if (ret) goto freegru; - ge->impl = x; touch_engine_init(&x->engine, tp_event, tp_sync, ge); touch_engine_attach(&x->engine, &x->dev); return 0; @@ -122,6 +122,7 @@ int grail_open(struct grail *ge, int fd) gin_destroy(ge); freemem: free(x); + ge->impl = 0; return ret; } @@ -168,3 +169,13 @@ int grail_pull(struct grail *ge, int fd) pthread_mutex_unlock(&x->mutex); return 1; } + +void grail_get_units(struct grail_coord *min, struct grail_coord *max, + const struct grail *ge) +{ + const struct touch_dev_caps *caps = &ge->impl->dev.caps; + min->x = caps->info[TP_POS_X].minimum; + min->y = caps->info[TP_POS_Y].minimum; + max->x = caps->info[TP_POS_X].maximum; + max->y = caps->info[TP_POS_Y].maximum; +} -- cgit v1.2.3