[mutter] udev: Pass the device as parameter on hotplug events



commit ea00c9604486ca7e3f3bbbbaf0ffed26ea5f7532
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Tue Aug 4 19:14:05 2020 +0200

    udev: Pass the device as parameter on hotplug events
    
    This will allow to find the related MetaKmsDevice that is emitting the
    hotplug event
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1964>

 src/backends/native/meta-kms.c  | 5 +++--
 src/backends/native/meta-udev.c | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/backends/native/meta-kms.c b/src/backends/native/meta-kms.c
index e66966f84b..87f302604f 100644
--- a/src/backends/native/meta-kms.c
+++ b/src/backends/native/meta-kms.c
@@ -626,8 +626,9 @@ meta_kms_resume (MetaKms *kms)
 }
 
 static void
-on_udev_hotplug (MetaUdev *udev,
-                 MetaKms  *kms)
+on_udev_hotplug (MetaUdev    *udev,
+                 GUdevDevice *udev_device,
+                 MetaKms     *kms)
 {
   handle_hotplug_event (kms);
 }
diff --git a/src/backends/native/meta-udev.c b/src/backends/native/meta-udev.c
index 9fd84e98b7..c0e0e165fd 100644
--- a/src/backends/native/meta-udev.c
+++ b/src/backends/native/meta-udev.c
@@ -208,7 +208,7 @@ on_uevent (GUdevClient *client,
     g_signal_emit (udev, signals[DEVICE_REMOVED], 0, device);
 
   if (g_udev_device_get_property_as_boolean (device, "HOTPLUG"))
-    g_signal_emit (udev, signals[HOTPLUG], 0);
+    g_signal_emit (udev, signals[HOTPLUG], 0, device);
 }
 
 MetaUdev *
@@ -256,7 +256,8 @@ meta_udev_class_init (MetaUdevClass *klass)
                   G_TYPE_FROM_CLASS (object_class),
                   G_SIGNAL_RUN_LAST,
                   0, NULL, NULL, NULL,
-                  G_TYPE_NONE, 0);
+                  G_TYPE_NONE, 1,
+                  G_UDEV_TYPE_DEVICE);
   signals[DEVICE_ADDED] =
     g_signal_new ("device-added",
                   G_TYPE_FROM_CLASS (object_class),


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