diff --git a/src/backends/meta-monitor-config-manager.c b/src/backends/meta-monitor-config-manager.c index 44ec494af..9e55d122b 100644 --- a/src/backends/meta-monitor-config-manager.c +++ b/src/backends/meta-monitor-config-manager.c @@ -327,8 +327,8 @@ meta_monitor_config_manager_assign (MetaMonitorManager *manager, return TRUE; } -static MetaMonitorsConfigKey * -create_key_for_current_state (MetaMonitorManager *monitor_manager) +MetaMonitorsConfigKey * +meta_create_monitors_config_key_for_current_state (MetaMonitorManager *monitor_manager) { MetaMonitorsConfigKey *config_key; GList *l; @@ -370,7 +370,8 @@ meta_monitor_config_manager_get_stored (MetaMonitorConfigManager *config_manager MetaMonitorsConfig *config; GError *error = NULL; - config_key = create_key_for_current_state (monitor_manager); + config_key = + meta_create_monitors_config_key_for_current_state (monitor_manager); if (!config_key) return NULL; diff --git a/src/backends/meta-monitor-config-manager.h b/src/backends/meta-monitor-config-manager.h index b99cdaba2..269d8e1b7 100644 --- a/src/backends/meta-monitor-config-manager.h +++ b/src/backends/meta-monitor-config-manager.h @@ -135,6 +135,8 @@ void meta_logical_monitor_config_free (MetaLogicalMonitorConfig *logical_monitor void meta_monitor_config_free (MetaMonitorConfig *monitor_config); +MetaMonitorsConfigKey * meta_create_monitors_config_key_for_current_state (MetaMonitorManager *monitor_manager); + gboolean meta_logical_monitor_configs_have_monitor (GList *logical_monitor_configs, MetaMonitorSpec *monitor_spec); diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c index 20c1687fc..c8a7880ab 100644 --- a/src/backends/meta-monitor-manager.c +++ b/src/backends/meta-monitor-manager.c @@ -1590,35 +1590,19 @@ static gboolean meta_monitor_manager_is_config_complete (MetaMonitorManager *manager, MetaMonitorsConfig *config) { - GList *l; - unsigned int configured_monitor_count = 0; - unsigned int expected_monitor_count = 0; + MetaMonitorsConfigKey *current_state_key; + gboolean is_config_complete; - for (l = config->logical_monitor_configs; l; l = l->next) - { - MetaLogicalMonitorConfig *logical_monitor_config = l->data; - GList *k; + current_state_key = + meta_create_monitors_config_key_for_current_state (manager); + if (!current_state_key) + return FALSE; - for (k = logical_monitor_config->monitor_configs; k; k = k->next) - configured_monitor_count++; - } + is_config_complete = meta_monitors_config_key_equal (current_state_key, + config->key); + meta_monitors_config_key_free (current_state_key); - for (l = manager->monitors; l; l = l->next) - { - MetaMonitor *monitor = l->data; - - if (meta_monitor_is_laptop_panel (monitor)) - { - if (!meta_monitor_manager_is_lid_closed (manager)) - expected_monitor_count++; - } - else - { - expected_monitor_count++; - } - } - - if (configured_monitor_count != expected_monitor_count) + if (!is_config_complete) return FALSE; return meta_monitor_manager_is_config_applicable (manager, config, NULL);