swc

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.nihaljere.xyz/swc
Log | Files | Refs | README | LICENSE

commit 266b8ad248fc90c0601ed2bb71cf74e9d8764a76
parent e4d437f440648de0f98c1ba2900330bf192b2443
Author: Michael Forney <mforney@mforney.org>
Date:   Tue, 22 Oct 2013 13:52:36 -0700

evdev: Use new libevdev API

Diffstat:
Mlibswc/evdev_device.c | 17++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/libswc/evdev_device.c b/libswc/evdev_device.c @@ -112,12 +112,19 @@ static int handle_data(int fd, uint32_t mask, void * data) struct input_event event; int ret; - do + while (true) { - ret = libevdev_next_event(device->dev, LIBEVDEV_READ_NORMAL, &event); + ret = libevdev_next_event(device->dev, LIBEVDEV_READ_FLAG_NORMAL, + &event); - while (ret == 1) - ret = libevdev_next_event(device->dev, LIBEVDEV_READ_SYNC, &event); + if (ret == -EAGAIN) + break; + + while (ret == LIBEVDEV_READ_STATUS_SYNC) + { + ret = libevdev_next_event(device->dev, LIBEVDEV_READ_FLAG_SYNC, + &event); + } if (!is_motion_event(&event)) handle_motion_events(device, timeval_to_msec(&event.time)); @@ -127,7 +134,7 @@ static int handle_data(int fd, uint32_t mask, void * data) { event_handlers[event.type](device, &event); } - } while (ret != -EAGAIN); + } handle_motion_events(device, timeval_to_msec(&event.time));