monitor-manager: Set up experimental HDR change listener after starting

This means we can fiddle with it during startup without an accidental
reconfigure being sneaked in by the listener.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3432>
This commit is contained in:
Jonas Ådahl 2023-11-09 13:10:37 +08:00 committed by Marge Bot
parent e4badfecb3
commit 3561f3c20e

View File

@ -1330,6 +1330,15 @@ meta_monitor_manager_setup (MetaMonitorManager *manager)
manager->in_init = FALSE;
}
static void
on_started (MetaContext *context,
MetaMonitorManager *monitor_manager)
{
g_signal_connect (monitor_manager, "notify::experimental-hdr",
G_CALLBACK (meta_monitor_manager_reconfigure),
NULL);
}
static void
meta_monitor_manager_constructed (GObject *object)
{
@ -1337,6 +1346,7 @@ meta_monitor_manager_constructed (GObject *object)
MetaMonitorManagerPrivate *priv =
meta_monitor_manager_get_instance_private (manager);
MetaBackend *backend = manager->backend;
MetaContext *context = meta_backend_get_context (backend);
MetaSettings *settings = meta_backend_get_settings (backend);
manager->display_config = meta_dbus_display_config_skeleton_new ();
@ -1375,14 +1385,11 @@ meta_monitor_manager_constructed (GObject *object)
G_CALLBACK (lid_is_closed_changed),
manager, 0);
g_signal_connect (context, "started", G_CALLBACK (on_started), manager);
g_signal_connect (backend, "prepare-shutdown",
G_CALLBACK (prepare_shutdown),
manager);
g_signal_connect (manager, "notify::experimental-hdr",
G_CALLBACK (ensure_hdr_settings),
NULL);
manager->current_switch_config = META_MONITOR_SWITCH_CONFIG_UNKNOWN;
initialize_dbus_interface (manager);