[mutter/wip/garnacho/virtual-input-device: 89/94] clutter/evdev: Make clutter_device_manager_get_device() lookup on the main seat
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/garnacho/virtual-input-device: 89/94] clutter/evdev: Make clutter_device_manager_get_device() lookup on the main seat
- Date: Wed, 20 Jul 2016 16:33:52 +0000 (UTC)
commit 106811f8d2312f1867f14137660e0c19f37784ba
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Jul 20 17:55:42 2016 +0200
clutter/evdev: Make clutter_device_manager_get_device() lookup on the main seat
The per-seat device lookup code has been separated into a function, so
it can be used with both the main and the additional seats.
.../clutter/evdev/clutter-device-manager-evdev.c | 41 ++++++++++++++++----
1 files changed, 33 insertions(+), 8 deletions(-)
---
diff --git a/clutter/clutter/evdev/clutter-device-manager-evdev.c
b/clutter/clutter/evdev/clutter-device-manager-evdev.c
index 73965da..792f3dd 100644
--- a/clutter/clutter/evdev/clutter-device-manager-evdev.c
+++ b/clutter/clutter/evdev/clutter-device-manager-evdev.c
@@ -889,28 +889,53 @@ clutter_device_manager_evdev_get_core_device (ClutterDeviceManager *manager,
}
static ClutterInputDevice *
+seat_get_device (ClutterSeatEvdev *seat,
+ gint id)
+{
+ GSList *device_it;
+
+ if (seat->core_pointer &&
+ clutter_input_device_get_device_id (seat->core_pointer) == id)
+ return seat->core_pointer;
+
+ if (seat->core_keyboard &&
+ clutter_input_device_get_device_id (seat->core_keyboard) == id)
+ return seat->core_keyboard;
+
+ for (device_it = seat->devices; device_it; device_it = device_it->next)
+ {
+ ClutterInputDevice *device = device_it->data;
+
+ if (clutter_input_device_get_device_id (device) == id)
+ return device;
+ }
+
+ return NULL;
+}
+
+static ClutterInputDevice *
clutter_device_manager_evdev_get_device (ClutterDeviceManager *manager,
gint id)
{
ClutterDeviceManagerEvdev *manager_evdev;
ClutterDeviceManagerEvdevPrivate *priv;
+ ClutterInputDevice *device;
GSList *l;
- GSList *device_it;
manager_evdev = CLUTTER_DEVICE_MANAGER_EVDEV (manager);
priv = manager_evdev->priv;
+ device = seat_get_device (priv->main_seat, id);
+ if (device)
+ return device;
+
for (l = priv->seats; l; l = l->next)
{
ClutterSeatEvdev *seat = l->data;
- for (device_it = seat->devices; device_it; device_it = device_it->next)
- {
- ClutterInputDevice *device = device_it->data;
-
- if (clutter_input_device_get_device_id (device) == id)
- return device;
- }
+ device = seat_get_device (seat, id);
+ if (device)
+ return device;
}
return NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]