From 1e7628a3ef8146ceda1dc385a6b66a9f2b741522 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Tue, 23 Aug 2016 15:36:31 +0800 Subject: [PATCH] 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 file changed, 15 insertions(+) diff --git a/clutter/clutter/evdev/clutter-virtual-input-device-evdev.c b/clutter/clutter/evdev/clutter-virtual-input-device-evdev.c index 3d8c204e7..c719d9ad8 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)) {