swc

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

commit 160ebbfc6d88d5c1315b3672c4424a967d3e79c1
parent 0013242c02a32f880bed4a84867903db30121152
Author: Michael Forney <mforney@mforney.org>
Date:   Mon,  6 Feb 2017 11:37:41 -0800

evdev_device: Use CLOCK_MONOTONIC

Otherwise a system clock change could interfere with input event timing.

Diffstat:
Mlibswc/evdev_device.c | 14++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/libswc/evdev_device.c b/libswc/evdev_device.c @@ -32,13 +32,14 @@ #include "seat.h" #include "util.h" -#include <stdlib.h> +#include <errno.h> +#include <fcntl.h> +#include <libevdev/libevdev.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> -#include <fcntl.h> +#include <time.h> #include <unistd.h> -#include <errno.h> -#include <libevdev/libevdev.h> #define AXIS_STEP_DISTANCE 10 #define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0])) @@ -234,6 +235,11 @@ evdev_device_new(const char *path, const struct evdev_device_handler *handler) goto error3; } + if (libevdev_set_clock_id(device->dev, CLOCK_MONOTONIC) != 0) { + ERROR("Failed to set libevdev device to monotonic clock\n"); + goto error4; + } + device->source = wl_event_loop_add_fd(swc.event_loop, device->fd, WL_EVENT_READABLE, handle_data, device); if (!device->source) {