[mutter] ClutterVirtualInputDevice: Allow passing CLUTTER_CURRENT_TIME



commit 1e7628a3ef8146ceda1dc385a6b66a9f2b741522
Author: Jonas Ådahl <jadahl gmail com>
Date:   Tue Aug 23 15:36:31 2016 +0800

    ClutterVirtualInputDevice: Allow passing CLUTTER_CURRENT_TIME
    
    If CLUTTER_CURRENT_TIME is passed, let the backend find an appropriate
    time stamp representing the current time in the clock that is used by
    that backend.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=784199

 .../evdev/clutter-virtual-input-device-evdev.c     |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter/evdev/clutter-virtual-input-device-evdev.c 
b/clutter/clutter/evdev/clutter-virtual-input-device-evdev.c
index 3d8c204..c719d9a 100644
--- a/clutter/clutter/evdev/clutter-virtual-input-device-evdev.c
+++ b/clutter/clutter/evdev/clutter-virtual-input-device-evdev.c
@@ -156,6 +156,9 @@ clutter_virtual_input_device_evdev_notify_relative_motion (ClutterVirtualInputDe
   ClutterVirtualInputDeviceEvdev *virtual_evdev =
     CLUTTER_VIRTUAL_INPUT_DEVICE_EVDEV (virtual_device);
 
+  if (time_us == CLUTTER_CURRENT_TIME)
+    time_us = g_get_monotonic_time ();
+
   clutter_seat_evdev_notify_relative_motion (virtual_evdev->seat,
                                              virtual_evdev->device,
                                              time_us,
@@ -172,6 +175,9 @@ clutter_virtual_input_device_evdev_notify_absolute_motion (ClutterVirtualInputDe
   ClutterVirtualInputDeviceEvdev *virtual_evdev =
     CLUTTER_VIRTUAL_INPUT_DEVICE_EVDEV (virtual_device);
 
+  if (time_us == CLUTTER_CURRENT_TIME)
+    time_us = g_get_monotonic_time ();
+
   clutter_seat_evdev_notify_absolute_motion (virtual_evdev->seat,
                                              virtual_evdev->device,
                                              time_us,
@@ -189,6 +195,9 @@ clutter_virtual_input_device_evdev_notify_button (ClutterVirtualInputDevice *vir
     CLUTTER_VIRTUAL_INPUT_DEVICE_EVDEV (virtual_device);
   int button_count;
 
+  if (time_us == CLUTTER_CURRENT_TIME)
+    time_us = g_get_monotonic_time ();
+
   if (get_button_type (button) != EVDEV_BUTTON_TYPE_BUTTON)
     {
       g_warning ("Unknown/invalid virtual device button 0x%x pressed",
@@ -222,6 +231,9 @@ clutter_virtual_input_device_evdev_notify_key (ClutterVirtualInputDevice *virtua
     CLUTTER_VIRTUAL_INPUT_DEVICE_EVDEV (virtual_device);
   int key_count;
 
+  if (time_us == CLUTTER_CURRENT_TIME)
+    time_us = g_get_monotonic_time ();
+
   if (get_button_type (key) != EVDEV_BUTTON_TYPE_KEY)
     {
       g_warning ("Unknown/invalid virtual device key 0x%x pressed\n", key);
@@ -343,6 +355,9 @@ clutter_virtual_input_device_evdev_notify_keyval (ClutterVirtualInputDevice *vir
   int key_count;
   guint keycode = 0, level = 0, evcode = 0;
 
+  if (time_us == CLUTTER_CURRENT_TIME)
+    time_us = g_get_monotonic_time ();
+
   if (!pick_keycode_for_keyval_in_current_group (virtual_device,
                                                  keyval, &keycode, &level))
     {


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