From ea00c9604486ca7e3f3bbbbaf0ffed26ea5f7532 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 4 Aug 2020 19:14:05 +0200 Subject: [PATCH] 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: --- 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 e66966f84..87f302604 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 9fd84e98b..c0e0e165f 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),