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
This commit is contained in:
Jonas Ådahl 2016-08-23 15:36:31 +08:00
parent d5a85997f2
commit 1e7628a3ef

View File

@ -156,6 +156,9 @@ clutter_virtual_input_device_evdev_notify_relative_motion (ClutterVirtualInputDe
ClutterVirtualInputDeviceEvdev *virtual_evdev = ClutterVirtualInputDeviceEvdev *virtual_evdev =
CLUTTER_VIRTUAL_INPUT_DEVICE_EVDEV (virtual_device); 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, clutter_seat_evdev_notify_relative_motion (virtual_evdev->seat,
virtual_evdev->device, virtual_evdev->device,
time_us, time_us,
@ -172,6 +175,9 @@ clutter_virtual_input_device_evdev_notify_absolute_motion (ClutterVirtualInputDe
ClutterVirtualInputDeviceEvdev *virtual_evdev = ClutterVirtualInputDeviceEvdev *virtual_evdev =
CLUTTER_VIRTUAL_INPUT_DEVICE_EVDEV (virtual_device); 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, clutter_seat_evdev_notify_absolute_motion (virtual_evdev->seat,
virtual_evdev->device, virtual_evdev->device,
time_us, time_us,
@ -189,6 +195,9 @@ clutter_virtual_input_device_evdev_notify_button (ClutterVirtualInputDevice *vir
CLUTTER_VIRTUAL_INPUT_DEVICE_EVDEV (virtual_device); CLUTTER_VIRTUAL_INPUT_DEVICE_EVDEV (virtual_device);
int button_count; int button_count;
if (time_us == CLUTTER_CURRENT_TIME)
time_us = g_get_monotonic_time ();
if (get_button_type (button) != EVDEV_BUTTON_TYPE_BUTTON) if (get_button_type (button) != EVDEV_BUTTON_TYPE_BUTTON)
{ {
g_warning ("Unknown/invalid virtual device button 0x%x pressed", 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); CLUTTER_VIRTUAL_INPUT_DEVICE_EVDEV (virtual_device);
int key_count; int key_count;
if (time_us == CLUTTER_CURRENT_TIME)
time_us = g_get_monotonic_time ();
if (get_button_type (key) != EVDEV_BUTTON_TYPE_KEY) if (get_button_type (key) != EVDEV_BUTTON_TYPE_KEY)
{ {
g_warning ("Unknown/invalid virtual device key 0x%x pressed\n", 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; int key_count;
guint keycode = 0, level = 0, evcode = 0; 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, if (!pick_keycode_for_keyval_in_current_group (virtual_device,
keyval, &keycode, &level)) keyval, &keycode, &level))
{ {