|
|
657d8e |
From 4ad8fd80355189ecbde6c38961335ae4be4db8b3 Mon Sep 17 00:00:00 2001
|
|
|
657d8e |
From: rpm-build <rpm-build>
|
|
|
657d8e |
Date: Tue, 11 Sep 2018 10:19:44 -0400
|
|
|
657d8e |
Subject: [PATCH] monitor-manager: only reuse initial-config if monitor
|
|
|
657d8e |
topology matches startup
|
|
|
657d8e |
|
|
|
657d8e |
Right now we try to apply the current monitor config when a new
|
|
|
657d8e |
monitor is attached. The current config obviously doesn't include the
|
|
|
657d8e |
new monitor, so the new monitor isn't lit up.
|
|
|
657d8e |
|
|
|
657d8e |
The only reason we apply the current config at all is to handle the
|
|
|
657d8e |
startup case: We want to reuse the config set in Xorg when first
|
|
|
657d8e |
logging in.
|
|
|
657d8e |
|
|
|
657d8e |
This commit changes the code to look at the *initial config* instead
|
|
|
657d8e |
of the current config, and only if the new monitor topology matches
|
|
|
657d8e |
the start up topology.
|
|
|
657d8e |
---
|
|
|
657d8e |
src/backends/meta-monitor-config-manager.c | 20 +++++++++++++++-----
|
|
|
657d8e |
src/backends/meta-monitor-config-manager.h | 2 +-
|
|
|
657d8e |
src/backends/meta-monitor-manager.c | 16 +++++++++++++++-
|
|
|
657d8e |
3 files changed, 31 insertions(+), 7 deletions(-)
|
|
|
657d8e |
|
|
|
657d8e |
diff --git a/src/backends/meta-monitor-config-manager.c b/src/backends/meta-monitor-config-manager.c
|
|
|
657d8e |
index d64ca1f79..c09edbe00 100644
|
|
|
657d8e |
--- a/src/backends/meta-monitor-config-manager.c
|
|
|
657d8e |
+++ b/src/backends/meta-monitor-config-manager.c
|
|
|
657d8e |
@@ -42,6 +42,7 @@ struct _MetaMonitorConfigManager
|
|
|
657d8e |
MetaMonitorConfigStore *config_store;
|
|
|
657d8e |
|
|
|
657d8e |
MetaMonitorsConfig *current_config;
|
|
|
657d8e |
+ MetaMonitorsConfig *initial_config;
|
|
|
657d8e |
GQueue config_history;
|
|
|
657d8e |
};
|
|
|
657d8e |
|
|
|
657d8e |
@@ -663,9 +664,10 @@ create_logical_monitor_config_from_output (MetaMonitorManager *monitor
|
|
|
657d8e |
}
|
|
|
657d8e |
|
|
|
657d8e |
MetaMonitorsConfig *
|
|
|
657d8e |
-meta_monitor_config_manager_create_current (MetaMonitorConfigManager *config_manager)
|
|
|
657d8e |
+meta_monitor_config_manager_create_initial (MetaMonitorConfigManager *config_manager)
|
|
|
657d8e |
{
|
|
|
657d8e |
MetaMonitorManager *monitor_manager = config_manager->monitor_manager;
|
|
|
657d8e |
+ MetaMonitorsConfig *initial_config;
|
|
|
657d8e |
GList *logical_monitor_configs;
|
|
|
657d8e |
MetaMonitor *primary_monitor;
|
|
|
657d8e |
MetaLogicalMonitorLayoutMode layout_mode;
|
|
|
657d8e |
@@ -673,6 +675,9 @@ meta_monitor_config_manager_create_current (MetaMonitorConfigManager *config_man
|
|
|
657d8e |
GList *monitors;
|
|
|
657d8e |
GList *l;
|
|
|
657d8e |
|
|
|
657d8e |
+ if (config_manager->initial_config != NULL)
|
|
|
657d8e |
+ return g_object_ref (config_manager->initial_config);
|
|
|
657d8e |
+
|
|
|
657d8e |
if (meta_monitor_config_store_get_config_count (config_manager->config_store) > 0)
|
|
|
657d8e |
return NULL;
|
|
|
657d8e |
|
|
|
657d8e |
@@ -714,10 +719,14 @@ meta_monitor_config_manager_create_current (MetaMonitorConfigManager *config_man
|
|
|
657d8e |
logical_monitor_config);
|
|
|
657d8e |
}
|
|
|
657d8e |
|
|
|
657d8e |
- return meta_monitors_config_new (monitor_manager,
|
|
|
657d8e |
- logical_monitor_configs,
|
|
|
657d8e |
- layout_mode,
|
|
|
657d8e |
- META_MONITORS_CONFIG_FLAG_NONE);
|
|
|
657d8e |
+ initial_config = meta_monitors_config_new (monitor_manager,
|
|
|
657d8e |
+ logical_monitor_configs,
|
|
|
657d8e |
+ layout_mode,
|
|
|
657d8e |
+ META_MONITORS_CONFIG_FLAG_NONE);
|
|
|
657d8e |
+
|
|
|
657d8e |
+ config_manager->initial_config = g_object_ref (initial_config);
|
|
|
657d8e |
+
|
|
|
657d8e |
+ return initial_config;
|
|
|
657d8e |
}
|
|
|
657d8e |
|
|
|
657d8e |
MetaMonitorsConfig *
|
|
|
657d8e |
@@ -1256,6 +1265,7 @@ meta_monitor_config_manager_dispose (GObject *object)
|
|
|
657d8e |
META_MONITOR_CONFIG_MANAGER (object);
|
|
|
657d8e |
|
|
|
657d8e |
g_clear_object (&config_manager->current_config);
|
|
|
657d8e |
+ g_clear_object (&config_manager->initial_config);
|
|
|
657d8e |
meta_monitor_config_manager_clear_history (config_manager);
|
|
|
657d8e |
|
|
|
657d8e |
G_OBJECT_CLASS (meta_monitor_config_manager_parent_class)->dispose (object);
|
|
|
657d8e |
diff --git a/src/backends/meta-monitor-config-manager.h b/src/backends/meta-monitor-config-manager.h
|
|
|
657d8e |
index 364a2b36b..409611bb0 100644
|
|
|
657d8e |
--- a/src/backends/meta-monitor-config-manager.h
|
|
|
657d8e |
+++ b/src/backends/meta-monitor-config-manager.h
|
|
|
657d8e |
@@ -95,7 +95,7 @@ META_EXPORT_TEST
|
|
|
657d8e |
MetaMonitorsConfig * meta_monitor_config_manager_get_stored (MetaMonitorConfigManager *config_manager);
|
|
|
657d8e |
|
|
|
657d8e |
META_EXPORT_TEST
|
|
|
657d8e |
-MetaMonitorsConfig * meta_monitor_config_manager_create_current (MetaMonitorConfigManager *config_manager);
|
|
|
657d8e |
+MetaMonitorsConfig * meta_monitor_config_manager_create_initial (MetaMonitorConfigManager *config_manager);
|
|
|
657d8e |
META_EXPORT_TEST
|
|
|
657d8e |
MetaMonitorsConfig * meta_monitor_config_manager_create_linear (MetaMonitorConfigManager *config_manager);
|
|
|
657d8e |
|
|
|
657d8e |
diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c
|
|
|
657d8e |
index 05b27c6be..bb4b44188 100644
|
|
|
657d8e |
--- a/src/backends/meta-monitor-manager.c
|
|
|
657d8e |
+++ b/src/backends/meta-monitor-manager.c
|
|
|
657d8e |
@@ -534,9 +534,11 @@ should_use_stored_config (MetaMonitorManager *manager)
|
|
|
657d8e |
MetaMonitorsConfig *
|
|
|
657d8e |
meta_monitor_manager_ensure_configured (MetaMonitorManager *manager)
|
|
|
657d8e |
{
|
|
|
657d8e |
+ g_autoptr (MetaMonitorsConfig) initial_config = NULL;
|
|
|
657d8e |
MetaMonitorsConfig *config = NULL;
|
|
|
657d8e |
GError *error = NULL;
|
|
|
657d8e |
gboolean use_stored_config;
|
|
|
657d8e |
+ MetaMonitorsConfigKey *current_state_key;
|
|
|
657d8e |
MetaMonitorsConfigMethod method;
|
|
|
657d8e |
MetaMonitorsConfigMethod fallback_method =
|
|
|
657d8e |
META_MONITORS_CONFIG_METHOD_TEMPORARY;
|
|
|
657d8e |
@@ -547,6 +549,18 @@ meta_monitor_manager_ensure_configured (MetaMonitorManager *manager)
|
|
|
657d8e |
else
|
|
|
657d8e |
method = META_MONITORS_CONFIG_METHOD_TEMPORARY;
|
|
|
657d8e |
|
|
|
657d8e |
+ initial_config = meta_monitor_config_manager_create_initial (manager->config_manager);
|
|
|
657d8e |
+
|
|
|
657d8e |
+ if (initial_config)
|
|
|
657d8e |
+ {
|
|
|
657d8e |
+ current_state_key = meta_create_monitors_config_key_for_current_state (manager);
|
|
|
657d8e |
+
|
|
|
657d8e |
+ /* don't ever reuse initial configuration, if the monitor topology changed
|
|
|
657d8e |
+ */
|
|
|
657d8e |
+ if (current_state_key && !meta_monitors_config_key_equal (current_state_key, initial_config->key))
|
|
|
657d8e |
+ g_clear_object (&initial_config);
|
|
|
657d8e |
+ }
|
|
|
657d8e |
+
|
|
|
657d8e |
if (use_stored_config)
|
|
|
657d8e |
{
|
|
|
657d8e |
config = meta_monitor_config_manager_get_stored (manager->config_manager);
|
|
|
657d8e |
@@ -614,7 +628,7 @@ meta_monitor_manager_ensure_configured (MetaMonitorManager *manager)
|
|
|
657d8e |
g_clear_object (&config);
|
|
|
657d8e |
}
|
|
|
657d8e |
|
|
|
657d8e |
- config = meta_monitor_config_manager_create_current (manager->config_manager);
|
|
|
657d8e |
+ config = g_steal_pointer (&initial_config);
|
|
|
657d8e |
if (config)
|
|
|
657d8e |
{
|
|
|
657d8e |
if (!meta_monitor_manager_apply_monitors_config (manager,
|
|
|
657d8e |
--
|
|
|
657d8e |
2.21.0
|
|
|
657d8e |
|