From 3b6bc1a7dc5871aef2c47426f87bb409a622de29 Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Fri, 6 Aug 2010 14:32:50 +0200 Subject: Remove thread code The primary usecase of grail involves using it together with the xserver, which is not threaded. Revert the touch-dev code back to the state prior to adding the threaded processing. Deferred event handling can be implemented by other means when needed. Signed-off-by: Henrik Rydberg --- src/touch-dev.c | 35 ++--------------------------------- 1 file changed, 2 insertions(+), 33 deletions(-) (limited to 'src/touch-dev.c') diff --git a/src/touch-dev.c b/src/touch-dev.c index b327266..4cc8d55 100644 --- a/src/touch-dev.c +++ b/src/touch-dev.c @@ -26,7 +26,6 @@ #include #include #include -#include "evbuf.h" /* from mtdev-mapping.h */ #define MT_TOUCH_MAJOR 0 @@ -50,7 +49,6 @@ struct touch_dev_impl { int status; grail_mask_t mask[DIM_TOUCH_BYTES]; touch_prop_t prop[DIM_TOUCH_PROP]; - struct evbuf evbuf; struct mtdev mtdev; }; @@ -82,23 +80,6 @@ static void set_caps(struct touch_dev_caps *caps, set_info(caps, TP_PRESSURE, &mtcaps->abs[MT_PRESSURE]); } -static int touch_get_fetched(struct touch_dev_impl *x, - struct input_event* ev, int ev_max) -{ - struct input_event kev; - int count = 0; - while (count < ev_max) { - while (mtdev_empty(&x->mtdev)) { - if (evbuf_empty(&x->evbuf)) - return count; - evbuf_get(&x->evbuf, &kev); - mtdev_put_event(&x->mtdev, &kev); - } - mtdev_get_event(&x->mtdev, &ev[count++]); - } - return count; -} - static inline void set_prop(struct touch_dev_impl *x, int code, int value) { grail_mask_set(x->mask, code); @@ -207,24 +188,12 @@ int touch_dev_idle(struct touch_dev *dev, int fd, int ms) return mtdev_idle(&dev->impl->mtdev, fd, ms); } -int touch_dev_fetch(struct touch_dev *dev, int fd) -{ - struct touch_dev_impl *x = dev->impl; - struct input_event ev; - int ret, count = 0; - while ((ret = mtdev_fetch_event(&x->mtdev, fd, &ev)) > 0) { - evbuf_put(&x->evbuf, &ev); - count++; - } - return count > 0 ? count : ret; -} - -int touch_dev_process(struct touch_dev *dev) +int touch_dev_pull(struct touch_dev *dev, int fd) { struct touch_dev_impl *x = dev->impl; struct input_event ev; int ret, count = 0, consumed; - while ((ret = touch_get_fetched(x, &ev, 1)) > 0) { + while ((ret = mtdev_get(&x->mtdev, fd, &ev, 1)) > 0) { consumed = 0; if (ev.type == EV_SYN) { if (ev.code == SYN_REPORT) -- cgit v1.2.3