clutter-device-evdev: Get devices from main seat if no real seat is set
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Tue, 15 May 2018 11:09:59 +0000 (12:09 +0100)
committerSimon McVittie <smcv@debian.org>
Sun, 8 Jul 2018 10:32:56 +0000 (11:32 +0100)
In devices such as ARM boards there could be no input devices connected on
startup, leading to a crash when we try to process artificial events that
could be queued (as gnome-shell does when syncing pointer).

Those events still should refer to a device and, in case we don't have one
provided by libinput we should still return the core devices defined in the
main seat.

(cherry picked from commit 3e85ac8131fc76312a2382d83df6926b88a37415)

Origin: upstream, 3.28.3, commit:2a6782dc10147a5a45f90ac318ba440f21f819d6

Gbp-Pq: Name clutter-device-evdev-Get-devices-from-main-seat-if-no-rea.patch

clutter/clutter/evdev/clutter-device-manager-evdev.c

index bc9549de9e78eb90160e47c2c9f35e82fcf6a081..812ad8c080af2d1ffac89583f261c0c1b723d21c 100644 (file)
@@ -919,7 +919,6 @@ clutter_device_manager_evdev_get_device (ClutterDeviceManager *manager,
   ClutterDeviceManagerEvdev *manager_evdev;
   ClutterDeviceManagerEvdevPrivate *priv;
   GSList *l;
-  GSList *device_it;
 
   manager_evdev = CLUTTER_DEVICE_MANAGER_EVDEV (manager);
   priv = manager_evdev->priv;
@@ -927,17 +926,13 @@ clutter_device_manager_evdev_get_device (ClutterDeviceManager *manager,
   for (l = priv->seats; l; l = l->next)
     {
       ClutterSeatEvdev *seat = l->data;
+      ClutterInputDevice *device = clutter_seat_evdev_get_device (seat, id);
 
-      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;
-        }
+      if (device)
+        return device;
     }
 
-  return NULL;
+  return clutter_seat_evdev_get_device (priv->main_seat, id);
 }
 
 static void