|
|
e47e58 |
From 702f204a281c6525da6bfcd2286d70b1ab6eab13 Mon Sep 17 00:00:00 2001
|
|
|
e47e58 |
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
|
|
e47e58 |
Date: Fri, 3 Nov 2017 15:58:02 +0800
|
|
|
e47e58 |
Subject: [PATCH 1/4] monitor-config-manager: Don't include closed laptop panel
|
|
|
e47e58 |
in config key
|
|
|
e47e58 |
|
|
|
e47e58 |
When deriving the list of disabled monitors when creating new monitors
|
|
|
e47e58 |
configs, don't include the laptop panel if the lid is currently closed,
|
|
|
e47e58 |
as we consider the laptop panel nonexistent when the laptop lid is
|
|
|
e47e58 |
closed when it comes to configuration.
|
|
|
e47e58 |
|
|
|
e47e58 |
The laptop panel connector(s) will either way be appropriately disabled
|
|
|
e47e58 |
anyway, as the field listing disabled monitors in the configuration do
|
|
|
e47e58 |
not affect actual CRTC/connector assignments.
|
|
|
e47e58 |
|
|
|
e47e58 |
https://bugzilla.gnome.org/show_bug.cgi?id=788915
|
|
|
e47e58 |
---
|
|
|
e47e58 |
src/backends/meta-monitor-config-manager.c | 4 ++++
|
|
|
e47e58 |
1 file changed, 4 insertions(+)
|
|
|
e47e58 |
|
|
|
e47e58 |
diff --git a/src/backends/meta-monitor-config-manager.c b/src/backends/meta-monitor-config-manager.c
|
|
|
e47e58 |
index 2fe620767..2a7287778 100644
|
|
|
e47e58 |
--- a/src/backends/meta-monitor-config-manager.c
|
|
|
e47e58 |
+++ b/src/backends/meta-monitor-config-manager.c
|
|
|
e47e58 |
@@ -1308,6 +1308,10 @@ meta_monitors_config_new (MetaMonitorManager *monitor_manager,
|
|
|
e47e58 |
MetaMonitor *monitor = l->data;
|
|
|
e47e58 |
MetaMonitorSpec *monitor_spec;
|
|
|
e47e58 |
|
|
|
e47e58 |
+ if (meta_monitor_manager_is_lid_closed (monitor_manager) &&
|
|
|
e47e58 |
+ meta_monitor_is_laptop_panel (monitor))
|
|
|
e47e58 |
+ continue;
|
|
|
e47e58 |
+
|
|
|
e47e58 |
monitor_spec = meta_monitor_get_spec (monitor);
|
|
|
e47e58 |
if (meta_logical_monitor_configs_have_monitor (logical_monitor_configs,
|
|
|
e47e58 |
monitor_spec))
|
|
|
e47e58 |
--
|
|
|
e47e58 |
2.14.2
|
|
|
e47e58 |
|
|
|
e47e58 |
From 584e2b93d9f28557cfe8a6ff720b4c3e45c458ab Mon Sep 17 00:00:00 2001
|
|
|
e47e58 |
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
|
|
e47e58 |
Date: Fri, 3 Nov 2017 16:03:23 +0800
|
|
|
e47e58 |
Subject: [PATCH 2/4] monitor-manager: Compare keys when checking whether a
|
|
|
e47e58 |
config is complete
|
|
|
e47e58 |
|
|
|
e47e58 |
We only counted configured monitors and whether the config was
|
|
|
e47e58 |
applicable (could be assigned), howeverwe didn't include disabled
|
|
|
e47e58 |
monitors when comparing. This could caused incorrect configurations to
|
|
|
e47e58 |
be applied when trying to use the previous configuration.
|
|
|
e47e58 |
|
|
|
e47e58 |
One scenario where this happened was one a system with one laptop
|
|
|
e47e58 |
screen and one external monitor that was hot plugged some point after
|
|
|
e47e58 |
start up. When the laptop lid was closed, the 'previous configuration'
|
|
|
e47e58 |
being the configuration where only the laptop panel was enabled, passed
|
|
|
e47e58 |
'is-complete' check as the number of configured monitors were correct,
|
|
|
e47e58 |
and the configuration was applicable.
|
|
|
e47e58 |
|
|
|
e47e58 |
Avoid this issue by simply comparing the configuration key of the
|
|
|
e47e58 |
previous configuration and the configuration key of the current state.
|
|
|
e47e58 |
This correctly identifies a laptop panel with the lid closed as
|
|
|
e47e58 |
inaccessible, thus doesn't incorrectly revert to the previous
|
|
|
e47e58 |
configuration.
|
|
|
e47e58 |
|
|
|
e47e58 |
https://bugzilla.gnome.org/show_bug.cgi?id=788915
|
|
|
e47e58 |
---
|
|
|
e47e58 |
src/backends/meta-monitor-config-manager.c | 7 +++---
|
|
|
e47e58 |
src/backends/meta-monitor-config-manager.h | 2 ++
|
|
|
e47e58 |
src/backends/meta-monitor-manager.c | 36 +++++++++---------------------
|
|
|
e47e58 |
3 files changed, 16 insertions(+), 29 deletions(-)
|
|
|
e47e58 |
|
|
|
e47e58 |
diff --git a/src/backends/meta-monitor-config-manager.c b/src/backends/meta-monitor-config-manager.c
|
|
|
e47e58 |
index 2a7287778..bdf863055 100644
|
|
|
e47e58 |
--- a/src/backends/meta-monitor-config-manager.c
|
|
|
e47e58 |
+++ b/src/backends/meta-monitor-config-manager.c
|
|
|
e47e58 |
@@ -326,8 +326,8 @@ meta_monitor_config_manager_assign (MetaMonitorManager *manager,
|
|
|
e47e58 |
return TRUE;
|
|
|
e47e58 |
}
|
|
|
e47e58 |
|
|
|
e47e58 |
-static MetaMonitorsConfigKey *
|
|
|
e47e58 |
-create_key_for_current_state (MetaMonitorManager *monitor_manager)
|
|
|
e47e58 |
+MetaMonitorsConfigKey *
|
|
|
e47e58 |
+meta_create_monitors_config_key_for_current_state (MetaMonitorManager *monitor_manager)
|
|
|
e47e58 |
{
|
|
|
e47e58 |
MetaMonitorsConfigKey *config_key;
|
|
|
e47e58 |
GList *l;
|
|
|
e47e58 |
@@ -369,7 +369,8 @@ meta_monitor_config_manager_get_stored (MetaMonitorConfigManager *config_manager
|
|
|
e47e58 |
MetaMonitorsConfig *config;
|
|
|
e47e58 |
GError *error = NULL;
|
|
|
e47e58 |
|
|
|
e47e58 |
- config_key = create_key_for_current_state (monitor_manager);
|
|
|
e47e58 |
+ config_key =
|
|
|
e47e58 |
+ meta_create_monitors_config_key_for_current_state (monitor_manager);
|
|
|
e47e58 |
if (!config_key)
|
|
|
e47e58 |
return NULL;
|
|
|
e47e58 |
|
|
|
e47e58 |
diff --git a/src/backends/meta-monitor-config-manager.h b/src/backends/meta-monitor-config-manager.h
|
|
|
e47e58 |
index 516909dd7..c36df38e6 100644
|
|
|
e47e58 |
--- a/src/backends/meta-monitor-config-manager.h
|
|
|
e47e58 |
+++ b/src/backends/meta-monitor-config-manager.h
|
|
|
e47e58 |
@@ -136,6 +136,8 @@ void meta_logical_monitor_config_free (MetaLogicalMonitorConfig *logical_monitor
|
|
|
e47e58 |
|
|
|
e47e58 |
void meta_monitor_config_free (MetaMonitorConfig *monitor_config);
|
|
|
e47e58 |
|
|
|
e47e58 |
+MetaMonitorsConfigKey * meta_create_monitors_config_key_for_current_state (MetaMonitorManager *monitor_manager);
|
|
|
e47e58 |
+
|
|
|
e47e58 |
gboolean meta_logical_monitor_configs_have_monitor (GList *logical_monitor_configs,
|
|
|
e47e58 |
MetaMonitorSpec *monitor_spec);
|
|
|
e47e58 |
|
|
|
e47e58 |
diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c
|
|
|
e47e58 |
index 8b548fd68..eb3612cf0 100644
|
|
|
e47e58 |
--- a/src/backends/meta-monitor-manager.c
|
|
|
e47e58 |
+++ b/src/backends/meta-monitor-manager.c
|
|
|
e47e58 |
@@ -1551,35 +1551,19 @@ static gboolean
|
|
|
e47e58 |
meta_monitor_manager_is_config_complete (MetaMonitorManager *manager,
|
|
|
e47e58 |
MetaMonitorsConfig *config)
|
|
|
e47e58 |
{
|
|
|
e47e58 |
- GList *l;
|
|
|
e47e58 |
- unsigned int configured_monitor_count = 0;
|
|
|
e47e58 |
- unsigned int expected_monitor_count = 0;
|
|
|
e47e58 |
-
|
|
|
e47e58 |
- for (l = config->logical_monitor_configs; l; l = l->next)
|
|
|
e47e58 |
- {
|
|
|
e47e58 |
- MetaLogicalMonitorConfig *logical_monitor_config = l->data;
|
|
|
e47e58 |
- GList *k;
|
|
|
e47e58 |
+ MetaMonitorsConfigKey *current_state_key;
|
|
|
e47e58 |
+ gboolean is_config_complete;
|
|
|
e47e58 |
|
|
|
e47e58 |
- for (k = logical_monitor_config->monitor_configs; k; k = k->next)
|
|
|
e47e58 |
- configured_monitor_count++;
|
|
|
e47e58 |
- }
|
|
|
e47e58 |
-
|
|
|
e47e58 |
- for (l = manager->monitors; l; l = l->next)
|
|
|
e47e58 |
- {
|
|
|
e47e58 |
- MetaMonitor *monitor = l->data;
|
|
|
e47e58 |
+ current_state_key =
|
|
|
e47e58 |
+ meta_create_monitors_config_key_for_current_state (manager);
|
|
|
e47e58 |
+ if (!current_state_key)
|
|
|
e47e58 |
+ return FALSE;
|
|
|
e47e58 |
|
|
|
e47e58 |
- if (meta_monitor_is_laptop_panel (monitor))
|
|
|
e47e58 |
- {
|
|
|
e47e58 |
- if (!meta_monitor_manager_is_lid_closed (manager))
|
|
|
e47e58 |
- expected_monitor_count++;
|
|
|
e47e58 |
- }
|
|
|
e47e58 |
- else
|
|
|
e47e58 |
- {
|
|
|
e47e58 |
- expected_monitor_count++;
|
|
|
e47e58 |
- }
|
|
|
e47e58 |
- }
|
|
|
e47e58 |
+ is_config_complete = meta_monitors_config_key_equal (current_state_key,
|
|
|
e47e58 |
+ config->key);
|
|
|
e47e58 |
+ meta_monitors_config_key_free (current_state_key);
|
|
|
e47e58 |
|
|
|
e47e58 |
- if (configured_monitor_count != expected_monitor_count)
|
|
|
e47e58 |
+ if (!is_config_complete)
|
|
|
e47e58 |
return FALSE;
|
|
|
e47e58 |
|
|
|
e47e58 |
return meta_monitor_manager_is_config_applicable (manager, config, NULL);
|
|
|
e47e58 |
--
|
|
|
e47e58 |
2.14.2
|
|
|
e47e58 |
|