diff options
author | Jonas Ådahl <jadahl@gmail.com> | 2017-03-10 15:11:56 +0800 |
---|---|---|
committer | Jonas Ådahl <jadahl@gmail.com> | 2017-03-11 09:16:27 +0800 |
commit | 73b2b30a1db807331c4ac546664f5e4ba6cb4511 (patch) | |
tree | 75fabf42a9e0b95508f48327d351b146c0ddd185 | |
parent | cf6b7bcb796bf8d5078b27e9b981cbbe56ab4961 (diff) | |
download | mutter-73b2b30a1db807331c4ac546664f5e4ba6cb4511.tar.gz |
monitor-manager-kms: Put uevent signal management in helpers
https://bugzilla.gnome.org/show_bug.cgi?id=779837
-rw-r--r-- | src/backends/native/meta-monitor-manager-kms.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/backends/native/meta-monitor-manager-kms.c b/src/backends/native/meta-monitor-manager-kms.c index 1d9bdfdf2..bad4fb641 100644 --- a/src/backends/native/meta-monitor-manager-kms.c +++ b/src/backends/native/meta-monitor-manager-kms.c @@ -112,6 +112,7 @@ struct _MetaMonitorManagerKms unsigned int n_connectors; GUdevClient *udev; + guint uevent_handler_id; GSettings *desktop_settings; @@ -1765,6 +1766,23 @@ static GSourceFuncs kms_event_funcs = { }; static void +meta_monitor_manager_kms_connect_uevent_handler (MetaMonitorManagerKms *manager_kms) +{ + manager_kms->uevent_handler_id = g_signal_connect (manager_kms->udev, + "uevent", + G_CALLBACK (on_uevent), + manager_kms); +} + +static void +meta_monitor_manager_kms_disconnect_uevent_handler (MetaMonitorManagerKms *manager_kms) +{ + g_signal_handler_disconnect (manager_kms->udev, + manager_kms->uevent_handler_id); + manager_kms->uevent_handler_id = 0; +} + +static void meta_monitor_manager_kms_init (MetaMonitorManagerKms *manager_kms) { MetaBackend *backend = meta_get_backend (); @@ -1778,8 +1796,7 @@ meta_monitor_manager_kms_init (MetaMonitorManagerKms *manager_kms) const char *subsystems[2] = { "drm", NULL }; manager_kms->udev = g_udev_client_new (subsystems); - g_signal_connect (manager_kms->udev, "uevent", - G_CALLBACK (on_uevent), manager_kms); + meta_monitor_manager_kms_connect_uevent_handler (manager_kms); source = g_source_new (&kms_event_funcs, sizeof (MetaKmsSource)); manager_kms->source = (MetaKmsSource *) source; |