[clutter/wip/wayland-compositor-help: 3/5] evdev: use monotonic times for the events



commit c6096d564f2d4078dfe2c8ad3471e87aa6bc59fc
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Thu Aug 22 00:19:21 2013 +0200

    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

 clutter/evdev/clutter-device-manager-evdev.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/clutter/evdev/clutter-device-manager-evdev.c b/clutter/evdev/clutter-device-manager-evdev.c
index a2994fe..17c48c8 100644
--- a/clutter/evdev/clutter-device-manager-evdev.c
+++ b/clutter/evdev/clutter-device-manager-evdev.c
@@ -562,7 +562,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 */
@@ -597,6 +597,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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]