summaryrefslogtreecommitdiff
path: root/src/grail-api.c
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@bitmath.org>2010-08-05 15:26:16 +0200
committerHenrik Rydberg <rydberg@euromail.se>2010-08-05 22:48:38 +0200
commit8bbf06f8d0056ae30fdfaf260000e763fad2345c (patch)
treeb52bae6d7250a31755726ec4a96f33863d3f5f7c /src/grail-api.c
parentd5f810a0d3e0013a76136750eaff825ceec099a2 (diff)
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 <rydberg@bitmath.org>
Diffstat (limited to 'src/grail-api.c')
-rw-r--r--src/grail-api.c15
1 files changed, 13 insertions, 2 deletions
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)
95 x = calloc(1, sizeof(*x)); 95 x = calloc(1, sizeof(*x));
96 if (!x) 96 if (!x)
97 return -ENOMEM; 97 return -ENOMEM;
98 ge->impl = x;
98 ret = gin_init(ge); 99 ret = gin_init(ge);
99 if (ret) 100 if (ret)
100 goto freemem; 101 goto freemem;
101 ret = touch_dev_open(&x->dev, fd); 102 ret = touch_dev_open(&x->dev, fd);
102 if (ret) 103 if (ret)
103 goto freegin; 104 goto freegin;
104 ret = gru_init(ge, &x->dev.caps); 105 ret = gru_init(ge);
105 if (ret) 106 if (ret)
106 goto freedev; 107 goto freedev;
107 x->fd = fd; 108 x->fd = fd;
@@ -110,7 +111,6 @@ int grail_open(struct grail *ge, int fd)
110 ret = pthread_create(&x->thread, NULL, grail_thread, x); 111 ret = pthread_create(&x->thread, NULL, grail_thread, x);
111 if (ret) 112 if (ret)
112 goto freegru; 113 goto freegru;
113 ge->impl = x;
114 touch_engine_init(&x->engine, tp_event, tp_sync, ge); 114 touch_engine_init(&x->engine, tp_event, tp_sync, ge);
115 touch_engine_attach(&x->engine, &x->dev); 115 touch_engine_attach(&x->engine, &x->dev);
116 return 0; 116 return 0;
@@ -122,6 +122,7 @@ int grail_open(struct grail *ge, int fd)
122 gin_destroy(ge); 122 gin_destroy(ge);
123 freemem: 123 freemem:
124 free(x); 124 free(x);
125 ge->impl = 0;
125 return ret; 126 return ret;
126} 127}
127 128
@@ -168,3 +169,13 @@ int grail_pull(struct grail *ge, int fd)
168 pthread_mutex_unlock(&x->mutex); 169 pthread_mutex_unlock(&x->mutex);
169 return 1; 170 return 1;
170} 171}
172
173void grail_get_units(struct grail_coord *min, struct grail_coord *max,
174 const struct grail *ge)
175{
176 const struct touch_dev_caps *caps = &ge->impl->dev.caps;
177 min->x = caps->info[TP_POS_X].minimum;
178 min->y = caps->info[TP_POS_Y].minimum;
179 max->x = caps->info[TP_POS_X].maximum;
180 max->y = caps->info[TP_POS_Y].maximum;
181}