monitor-manager-kms: Put uevent signal management in helpers
https://bugzilla.gnome.org/show_bug.cgi?id=779837
This commit is contained in:
parent
cf6b7bcb79
commit
73b2b30a1d
@ -112,6 +112,7 @@ struct _MetaMonitorManagerKms
|
||||
unsigned int n_connectors;
|
||||
|
||||
GUdevClient *udev;
|
||||
guint uevent_handler_id;
|
||||
|
||||
GSettings *desktop_settings;
|
||||
|
||||
@ -1764,6 +1765,23 @@ static GSourceFuncs kms_event_funcs = {
|
||||
kms_event_dispatch
|
||||
};
|
||||
|
||||
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)
|
||||
{
|
||||
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user