mirror of
https://github.com/brl/mutter.git
synced 2025-01-25 19:08:56 +00:00
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:
parent
aef3d0022c
commit
b73f513091
@ -567,7 +567,7 @@ clutter_event_source_new (ClutterInputDeviceEvdev *input_device)
|
|||||||
GSource *source = g_source_new (&event_funcs, sizeof (ClutterEventSource));
|
GSource *source = g_source_new (&event_funcs, sizeof (ClutterEventSource));
|
||||||
ClutterEventSource *event_source = (ClutterEventSource *) source;
|
ClutterEventSource *event_source = (ClutterEventSource *) source;
|
||||||
const gchar *node_path;
|
const gchar *node_path;
|
||||||
gint fd;
|
gint fd, clkid;
|
||||||
GError *error;
|
GError *error;
|
||||||
|
|
||||||
/* grab the udev input device node and open it */
|
/* 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.fd = fd;
|
||||||
event_source->event_poll_fd.events = G_IO_IN;
|
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 */
|
/* and finally configure and attach the GSource */
|
||||||
g_source_set_priority (source, CLUTTER_PRIORITY_EVENTS);
|
g_source_set_priority (source, CLUTTER_PRIORITY_EVENTS);
|
||||||
g_source_add_poll (source, &event_source->event_poll_fd);
|
g_source_add_poll (source, &event_source->event_poll_fd);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user