evdev: use monotonic times for the events

The monotonic clock is what X uses too, so this way the timestamps
can be compared.

https://bugzilla.gnome.org/show_bug.cgi?id=706543
This commit is contained in:
Giovanni Campagna 2013-08-22 00:19:21 +02:00 committed by Giovanni Campagna
parent aef3d0022c
commit b73f513091

View File

@ -567,7 +567,7 @@ clutter_event_source_new (ClutterInputDeviceEvdev *input_device)
GSource *source = g_source_new (&event_funcs, sizeof (ClutterEventSource));
ClutterEventSource *event_source = (ClutterEventSource *) source;
const gchar *node_path;
gint fd;
gint fd, clkid;
GError *error;
/* grab the udev input device node and open it */
@ -602,6 +602,10 @@ clutter_event_source_new (ClutterInputDeviceEvdev *input_device)
event_source->event_poll_fd.fd = fd;
event_source->event_poll_fd.events = G_IO_IN;
/* Tell evdev to use the monotonic clock for its timestamps */
clkid = CLOCK_MONOTONIC;
ioctl (fd, EVIOCSCLOCKID, &clkid);
/* and finally configure and attach the GSource */
g_source_set_priority (source, CLUTTER_PRIORITY_EVENTS);
g_source_add_poll (source, &event_source->event_poll_fd);