|
|
f73620 |
From 0cc90f343f4caadb5c4279623a0811c378715a09 Mon Sep 17 00:00:00 2001
|
|
|
f73620 |
From: rpm-build <rpm-build>
|
|
|
f73620 |
Date: Tue, 11 Sep 2018 10:19:44 -0400
|
|
|
f73620 |
Subject: [PATCH] monitor-manager: only reuse initial-config if monitor
|
|
|
f73620 |
topology matches startup
|
|
|
f73620 |
|
|
|
f73620 |
Right now we try to apply the current monitor config when a new
|
|
|
f73620 |
monitor is attached. The current config obviously doesn't include the
|
|
|
f73620 |
new monitor, so the new monitor isn't lit up.
|
|
|
f73620 |
|
|
|
f73620 |
The only reason we apply the current config at all is to handle the
|
|
|
f73620 |
startup case: We want to reuse the config set in Xorg when first
|
|
|
f73620 |
logging in.
|
|
|
f73620 |
|
|
|
f73620 |
This commit changes the code to look at the *initial config* instead
|
|
|
f73620 |
of the current config, and only if the new monitor topology matches
|
|
|
f73620 |
the start up topology.
|
|
|
f73620 |
---
|
|
|
f73620 |
src/backends/meta-monitor-config-manager.c | 20 +++++++++++++++-----
|
|
|
f73620 |
src/backends/meta-monitor-config-manager.h | 2 +-
|
|
|
f73620 |
src/backends/meta-monitor-manager.c | 16 +++++++++++++++-
|
|
|
f73620 |
3 files changed, 31 insertions(+), 7 deletions(-)
|
|
|
f73620 |
|
|
|
f73620 |
diff --git a/src/backends/meta-monitor-config-manager.c b/src/backends/meta-monitor-config-manager.c
|
|
|
f73620 |
index 585ee7034..1ad342a44 100644
|
|
|
f73620 |
--- a/src/backends/meta-monitor-config-manager.c
|
|
|
f73620 |
+++ b/src/backends/meta-monitor-config-manager.c
|
|
|
f73620 |
@@ -13,60 +13,61 @@
|
|
|
f73620 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
f73620 |
* General Public License for more details.
|
|
|
f73620 |
*
|
|
|
f73620 |
* You should have received a copy of the GNU General Public License
|
|
|
f73620 |
* along with this program; if not, write to the Free Software
|
|
|
f73620 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
|
f73620 |
* 02111-1307, USA.
|
|
|
f73620 |
*/
|
|
|
f73620 |
|
|
|
f73620 |
#include "config.h"
|
|
|
f73620 |
|
|
|
f73620 |
#include "backends/meta-monitor-config-manager.h"
|
|
|
f73620 |
|
|
|
f73620 |
#include "backends/meta-monitor-config-migration.h"
|
|
|
f73620 |
#include "backends/meta-monitor-config-store.h"
|
|
|
f73620 |
#include "backends/meta-monitor-manager-private.h"
|
|
|
f73620 |
#include "backends/meta-output.h"
|
|
|
f73620 |
#include "core/boxes-private.h"
|
|
|
f73620 |
|
|
|
f73620 |
#define CONFIG_HISTORY_MAX_SIZE 3
|
|
|
f73620 |
|
|
|
f73620 |
struct _MetaMonitorConfigManager
|
|
|
f73620 |
{
|
|
|
f73620 |
GObject parent;
|
|
|
f73620 |
|
|
|
f73620 |
MetaMonitorManager *monitor_manager;
|
|
|
f73620 |
|
|
|
f73620 |
MetaMonitorConfigStore *config_store;
|
|
|
f73620 |
|
|
|
f73620 |
MetaMonitorsConfig *current_config;
|
|
|
f73620 |
+ MetaMonitorsConfig *initial_config;
|
|
|
f73620 |
GQueue config_history;
|
|
|
f73620 |
};
|
|
|
f73620 |
|
|
|
f73620 |
G_DEFINE_TYPE (MetaMonitorConfigManager, meta_monitor_config_manager,
|
|
|
f73620 |
G_TYPE_OBJECT)
|
|
|
f73620 |
|
|
|
f73620 |
G_DEFINE_TYPE (MetaMonitorsConfig, meta_monitors_config,
|
|
|
f73620 |
G_TYPE_OBJECT)
|
|
|
f73620 |
|
|
|
f73620 |
static void
|
|
|
f73620 |
meta_crtc_info_free (MetaCrtcInfo *info);
|
|
|
f73620 |
|
|
|
f73620 |
static void
|
|
|
f73620 |
meta_output_info_free (MetaOutputInfo *info);
|
|
|
f73620 |
|
|
|
f73620 |
MetaMonitorConfigManager *
|
|
|
f73620 |
meta_monitor_config_manager_new (MetaMonitorManager *monitor_manager)
|
|
|
f73620 |
{
|
|
|
f73620 |
MetaMonitorConfigManager *config_manager;
|
|
|
f73620 |
|
|
|
f73620 |
config_manager = g_object_new (META_TYPE_MONITOR_CONFIG_MANAGER, NULL);
|
|
|
f73620 |
config_manager->monitor_manager = monitor_manager;
|
|
|
f73620 |
config_manager->config_store =
|
|
|
f73620 |
meta_monitor_config_store_new (monitor_manager);
|
|
|
f73620 |
|
|
|
f73620 |
return config_manager;
|
|
|
f73620 |
}
|
|
|
f73620 |
|
|
|
f73620 |
MetaMonitorConfigStore *
|
|
|
f73620 |
meta_monitor_config_manager_get_store (MetaMonitorConfigManager *config_manager)
|
|
|
f73620 |
@@ -552,115 +553,123 @@ create_preferred_logical_monitor_config (MetaMonitorManager *monitor_ma
|
|
|
f73620 |
.width = width,
|
|
|
f73620 |
.height = height
|
|
|
f73620 |
},
|
|
|
f73620 |
.scale = scale,
|
|
|
f73620 |
.monitor_configs = g_list_append (NULL, monitor_config)
|
|
|
f73620 |
};
|
|
|
f73620 |
|
|
|
f73620 |
return logical_monitor_config;
|
|
|
f73620 |
}
|
|
|
f73620 |
|
|
|
f73620 |
static MetaLogicalMonitorConfig *
|
|
|
f73620 |
create_logical_monitor_config_from_output (MetaMonitorManager *monitor_manager,
|
|
|
f73620 |
MetaMonitor *monitor,
|
|
|
f73620 |
MetaLogicalMonitorConfig *primary_logical_monitor_config,
|
|
|
f73620 |
MetaLogicalMonitorLayoutMode layout_mode)
|
|
|
f73620 |
{
|
|
|
f73620 |
MetaOutput *output;
|
|
|
f73620 |
MetaCrtc *crtc;
|
|
|
f73620 |
|
|
|
f73620 |
output = meta_monitor_get_main_output (monitor);
|
|
|
f73620 |
crtc = meta_output_get_assigned_crtc (output);
|
|
|
f73620 |
return create_preferred_logical_monitor_config (monitor_manager,
|
|
|
f73620 |
monitor,
|
|
|
f73620 |
crtc->rect.x,
|
|
|
f73620 |
crtc->rect.y,
|
|
|
f73620 |
primary_logical_monitor_config,
|
|
|
f73620 |
layout_mode);
|
|
|
f73620 |
}
|
|
|
f73620 |
|
|
|
f73620 |
MetaMonitorsConfig *
|
|
|
f73620 |
-meta_monitor_config_manager_create_current (MetaMonitorConfigManager *config_manager)
|
|
|
f73620 |
+meta_monitor_config_manager_create_initial (MetaMonitorConfigManager *config_manager)
|
|
|
f73620 |
{
|
|
|
f73620 |
MetaMonitorManager *monitor_manager = config_manager->monitor_manager;
|
|
|
f73620 |
+ MetaMonitorsConfig *initial_config;
|
|
|
f73620 |
GList *logical_monitor_configs;
|
|
|
f73620 |
MetaMonitor *primary_monitor;
|
|
|
f73620 |
MetaLogicalMonitorLayoutMode layout_mode;
|
|
|
f73620 |
MetaLogicalMonitorConfig *primary_logical_monitor_config;
|
|
|
f73620 |
GList *monitors;
|
|
|
f73620 |
GList *l;
|
|
|
f73620 |
|
|
|
f73620 |
+ if (config_manager->initial_config != NULL)
|
|
|
f73620 |
+ return g_object_ref (config_manager->initial_config);
|
|
|
f73620 |
+
|
|
|
f73620 |
if (meta_monitor_config_store_get_config_count (config_manager->config_store) > 0)
|
|
|
f73620 |
return NULL;
|
|
|
f73620 |
|
|
|
f73620 |
primary_monitor = find_primary_monitor (monitor_manager);
|
|
|
f73620 |
if (!primary_monitor || !meta_monitor_is_active (primary_monitor))
|
|
|
f73620 |
return NULL;
|
|
|
f73620 |
|
|
|
f73620 |
layout_mode = meta_monitor_manager_get_default_layout_mode (monitor_manager);
|
|
|
f73620 |
|
|
|
f73620 |
primary_logical_monitor_config =
|
|
|
f73620 |
create_logical_monitor_config_from_output (monitor_manager,
|
|
|
f73620 |
primary_monitor,
|
|
|
f73620 |
NULL,
|
|
|
f73620 |
layout_mode);
|
|
|
f73620 |
|
|
|
f73620 |
primary_logical_monitor_config->is_primary = TRUE;
|
|
|
f73620 |
logical_monitor_configs = g_list_append (NULL,
|
|
|
f73620 |
primary_logical_monitor_config);
|
|
|
f73620 |
|
|
|
f73620 |
monitors = meta_monitor_manager_get_monitors (monitor_manager);
|
|
|
f73620 |
for (l = monitors; l; l = l->next)
|
|
|
f73620 |
{
|
|
|
f73620 |
MetaMonitor *monitor = l->data;
|
|
|
f73620 |
MetaLogicalMonitorConfig *logical_monitor_config;
|
|
|
f73620 |
|
|
|
f73620 |
if (monitor == primary_monitor)
|
|
|
f73620 |
continue;
|
|
|
f73620 |
|
|
|
f73620 |
if (!meta_monitor_is_active (monitor))
|
|
|
f73620 |
continue;
|
|
|
f73620 |
|
|
|
f73620 |
logical_monitor_config =
|
|
|
f73620 |
create_logical_monitor_config_from_output (monitor_manager,
|
|
|
f73620 |
monitor,
|
|
|
f73620 |
primary_logical_monitor_config,
|
|
|
f73620 |
layout_mode);
|
|
|
f73620 |
|
|
|
f73620 |
logical_monitor_configs = g_list_append (logical_monitor_configs,
|
|
|
f73620 |
logical_monitor_config);
|
|
|
f73620 |
}
|
|
|
f73620 |
|
|
|
f73620 |
- return meta_monitors_config_new (monitor_manager,
|
|
|
f73620 |
- logical_monitor_configs,
|
|
|
f73620 |
- layout_mode,
|
|
|
f73620 |
- META_MONITORS_CONFIG_FLAG_NONE);
|
|
|
f73620 |
+ initial_config = meta_monitors_config_new (monitor_manager,
|
|
|
f73620 |
+ logical_monitor_configs,
|
|
|
f73620 |
+ layout_mode,
|
|
|
f73620 |
+ META_MONITORS_CONFIG_FLAG_NONE);
|
|
|
f73620 |
+
|
|
|
f73620 |
+ config_manager->initial_config = g_object_ref (initial_config);
|
|
|
f73620 |
+
|
|
|
f73620 |
+ return initial_config;
|
|
|
f73620 |
}
|
|
|
f73620 |
|
|
|
f73620 |
MetaMonitorsConfig *
|
|
|
f73620 |
meta_monitor_config_manager_create_linear (MetaMonitorConfigManager *config_manager)
|
|
|
f73620 |
{
|
|
|
f73620 |
MetaMonitorManager *monitor_manager = config_manager->monitor_manager;
|
|
|
f73620 |
GList *logical_monitor_configs;
|
|
|
f73620 |
MetaMonitor *primary_monitor;
|
|
|
f73620 |
MetaLogicalMonitorLayoutMode layout_mode;
|
|
|
f73620 |
MetaLogicalMonitorConfig *primary_logical_monitor_config;
|
|
|
f73620 |
int x;
|
|
|
f73620 |
GList *monitors;
|
|
|
f73620 |
GList *l;
|
|
|
f73620 |
|
|
|
f73620 |
primary_monitor = find_primary_monitor (monitor_manager);
|
|
|
f73620 |
if (!primary_monitor)
|
|
|
f73620 |
return NULL;
|
|
|
f73620 |
|
|
|
f73620 |
layout_mode = meta_monitor_manager_get_default_layout_mode (monitor_manager);
|
|
|
f73620 |
|
|
|
f73620 |
primary_logical_monitor_config =
|
|
|
f73620 |
create_preferred_logical_monitor_config (monitor_manager,
|
|
|
f73620 |
primary_monitor,
|
|
|
f73620 |
0, 0,
|
|
|
f73620 |
NULL,
|
|
|
f73620 |
layout_mode);
|
|
|
f73620 |
primary_logical_monitor_config->is_primary = TRUE;
|
|
|
f73620 |
logical_monitor_configs = g_list_append (NULL,
|
|
|
f73620 |
primary_logical_monitor_config);
|
|
|
f73620 |
|
|
|
f73620 |
@@ -1135,60 +1144,61 @@ meta_monitor_config_manager_get_current (MetaMonitorConfigManager *config_manage
|
|
|
f73620 |
{
|
|
|
f73620 |
return config_manager->current_config;
|
|
|
f73620 |
}
|
|
|
f73620 |
|
|
|
f73620 |
MetaMonitorsConfig *
|
|
|
f73620 |
meta_monitor_config_manager_pop_previous (MetaMonitorConfigManager *config_manager)
|
|
|
f73620 |
{
|
|
|
f73620 |
return g_queue_pop_head (&config_manager->config_history);
|
|
|
f73620 |
}
|
|
|
f73620 |
|
|
|
f73620 |
MetaMonitorsConfig *
|
|
|
f73620 |
meta_monitor_config_manager_get_previous (MetaMonitorConfigManager *config_manager)
|
|
|
f73620 |
{
|
|
|
f73620 |
return g_queue_peek_head (&config_manager->config_history);
|
|
|
f73620 |
}
|
|
|
f73620 |
|
|
|
f73620 |
void
|
|
|
f73620 |
meta_monitor_config_manager_clear_history (MetaMonitorConfigManager *config_manager)
|
|
|
f73620 |
{
|
|
|
f73620 |
g_queue_foreach (&config_manager->config_history, (GFunc) g_object_unref, NULL);
|
|
|
f73620 |
g_queue_clear (&config_manager->config_history);
|
|
|
f73620 |
}
|
|
|
f73620 |
|
|
|
f73620 |
static void
|
|
|
f73620 |
meta_monitor_config_manager_dispose (GObject *object)
|
|
|
f73620 |
{
|
|
|
f73620 |
MetaMonitorConfigManager *config_manager =
|
|
|
f73620 |
META_MONITOR_CONFIG_MANAGER (object);
|
|
|
f73620 |
|
|
|
f73620 |
g_clear_object (&config_manager->current_config);
|
|
|
f73620 |
+ g_clear_object (&config_manager->initial_config);
|
|
|
f73620 |
meta_monitor_config_manager_clear_history (config_manager);
|
|
|
f73620 |
|
|
|
f73620 |
G_OBJECT_CLASS (meta_monitor_config_manager_parent_class)->dispose (object);
|
|
|
f73620 |
}
|
|
|
f73620 |
|
|
|
f73620 |
static void
|
|
|
f73620 |
meta_monitor_config_manager_init (MetaMonitorConfigManager *config_manager)
|
|
|
f73620 |
{
|
|
|
f73620 |
g_queue_init (&config_manager->config_history);
|
|
|
f73620 |
}
|
|
|
f73620 |
|
|
|
f73620 |
static void
|
|
|
f73620 |
meta_monitor_config_manager_class_init (MetaMonitorConfigManagerClass *klass)
|
|
|
f73620 |
{
|
|
|
f73620 |
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
f73620 |
|
|
|
f73620 |
object_class->dispose = meta_monitor_config_manager_dispose;
|
|
|
f73620 |
}
|
|
|
f73620 |
|
|
|
f73620 |
void
|
|
|
f73620 |
meta_monitor_config_free (MetaMonitorConfig *monitor_config)
|
|
|
f73620 |
{
|
|
|
f73620 |
meta_monitor_spec_free (monitor_config->monitor_spec);
|
|
|
f73620 |
g_free (monitor_config->mode_spec);
|
|
|
f73620 |
g_free (monitor_config);
|
|
|
f73620 |
}
|
|
|
f73620 |
|
|
|
f73620 |
void
|
|
|
f73620 |
meta_logical_monitor_config_free (MetaLogicalMonitorConfig *logical_monitor_config)
|
|
|
f73620 |
{
|
|
|
f73620 |
diff --git a/src/backends/meta-monitor-config-manager.h b/src/backends/meta-monitor-config-manager.h
|
|
|
f73620 |
index c36df38e6..29ef8f8ce 100644
|
|
|
f73620 |
--- a/src/backends/meta-monitor-config-manager.h
|
|
|
f73620 |
+++ b/src/backends/meta-monitor-config-manager.h
|
|
|
f73620 |
@@ -60,61 +60,61 @@ typedef enum _MetaMonitorsConfigFlag
|
|
|
f73620 |
struct _MetaMonitorsConfig
|
|
|
f73620 |
{
|
|
|
f73620 |
GObject parent;
|
|
|
f73620 |
|
|
|
f73620 |
MetaMonitorsConfigKey *key;
|
|
|
f73620 |
GList *logical_monitor_configs;
|
|
|
f73620 |
|
|
|
f73620 |
GList *disabled_monitor_specs;
|
|
|
f73620 |
|
|
|
f73620 |
MetaMonitorsConfigFlag flags;
|
|
|
f73620 |
|
|
|
f73620 |
MetaLogicalMonitorLayoutMode layout_mode;
|
|
|
f73620 |
};
|
|
|
f73620 |
|
|
|
f73620 |
#define META_TYPE_MONITORS_CONFIG (meta_monitors_config_get_type ())
|
|
|
f73620 |
G_DECLARE_FINAL_TYPE (MetaMonitorsConfig, meta_monitors_config,
|
|
|
f73620 |
META, MONITORS_CONFIG, GObject)
|
|
|
f73620 |
|
|
|
f73620 |
MetaMonitorConfigManager * meta_monitor_config_manager_new (MetaMonitorManager *monitor_manager);
|
|
|
f73620 |
|
|
|
f73620 |
MetaMonitorConfigStore * meta_monitor_config_manager_get_store (MetaMonitorConfigManager *config_manager);
|
|
|
f73620 |
|
|
|
f73620 |
gboolean meta_monitor_config_manager_assign (MetaMonitorManager *manager,
|
|
|
f73620 |
MetaMonitorsConfig *config,
|
|
|
f73620 |
GPtrArray **crtc_infos,
|
|
|
f73620 |
GPtrArray **output_infos,
|
|
|
f73620 |
GError **error);
|
|
|
f73620 |
|
|
|
f73620 |
MetaMonitorsConfig * meta_monitor_config_manager_get_stored (MetaMonitorConfigManager *config_manager);
|
|
|
f73620 |
|
|
|
f73620 |
-MetaMonitorsConfig * meta_monitor_config_manager_create_current (MetaMonitorConfigManager *config_manager);
|
|
|
f73620 |
+MetaMonitorsConfig * meta_monitor_config_manager_create_initial (MetaMonitorConfigManager *config_manager);
|
|
|
f73620 |
MetaMonitorsConfig * meta_monitor_config_manager_create_linear (MetaMonitorConfigManager *config_manager);
|
|
|
f73620 |
|
|
|
f73620 |
MetaMonitorsConfig * meta_monitor_config_manager_create_fallback (MetaMonitorConfigManager *config_manager);
|
|
|
f73620 |
|
|
|
f73620 |
MetaMonitorsConfig * meta_monitor_config_manager_create_suggested (MetaMonitorConfigManager *config_manager);
|
|
|
f73620 |
|
|
|
f73620 |
MetaMonitorsConfig * meta_monitor_config_manager_create_for_orientation (MetaMonitorConfigManager *config_manager,
|
|
|
f73620 |
MetaMonitorTransform transform);
|
|
|
f73620 |
|
|
|
f73620 |
MetaMonitorsConfig * meta_monitor_config_manager_create_for_rotate_monitor (MetaMonitorConfigManager *config_manager);
|
|
|
f73620 |
|
|
|
f73620 |
MetaMonitorsConfig * meta_monitor_config_manager_create_for_switch_config (MetaMonitorConfigManager *config_manager,
|
|
|
f73620 |
MetaMonitorSwitchConfigType config_type);
|
|
|
f73620 |
|
|
|
f73620 |
void meta_monitor_config_manager_set_current (MetaMonitorConfigManager *config_manager,
|
|
|
f73620 |
MetaMonitorsConfig *config);
|
|
|
f73620 |
|
|
|
f73620 |
MetaMonitorsConfig * meta_monitor_config_manager_get_current (MetaMonitorConfigManager *config_manager);
|
|
|
f73620 |
|
|
|
f73620 |
MetaMonitorsConfig * meta_monitor_config_manager_pop_previous (MetaMonitorConfigManager *config_manager);
|
|
|
f73620 |
|
|
|
f73620 |
MetaMonitorsConfig * meta_monitor_config_manager_get_previous (MetaMonitorConfigManager *config_manager);
|
|
|
f73620 |
|
|
|
f73620 |
void meta_monitor_config_manager_clear_history (MetaMonitorConfigManager *config_manager);
|
|
|
f73620 |
|
|
|
f73620 |
void meta_monitor_config_manager_save_current (MetaMonitorConfigManager *config_manager);
|
|
|
f73620 |
|
|
|
f73620 |
MetaMonitorsConfig * meta_monitors_config_new_full (GList *logical_monitor_configs,
|
|
|
f73620 |
GList *disabled_monitors,
|
|
|
f73620 |
MetaLogicalMonitorLayoutMode layout_mode,
|
|
|
f73620 |
diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c
|
|
|
f73620 |
index 4503eb841..f7ada0136 100644
|
|
|
f73620 |
--- a/src/backends/meta-monitor-manager.c
|
|
|
f73620 |
+++ b/src/backends/meta-monitor-manager.c
|
|
|
f73620 |
@@ -469,73 +469,87 @@ meta_monitor_manager_apply_monitors_config (MetaMonitorManager *manager,
|
|
|
f73620 |
|
|
|
f73620 |
return TRUE;
|
|
|
f73620 |
}
|
|
|
f73620 |
|
|
|
f73620 |
gboolean
|
|
|
f73620 |
meta_monitor_manager_has_hotplug_mode_update (MetaMonitorManager *manager)
|
|
|
f73620 |
{
|
|
|
f73620 |
GList *l;
|
|
|
f73620 |
|
|
|
f73620 |
for (l = manager->gpus; l; l = l->next)
|
|
|
f73620 |
{
|
|
|
f73620 |
MetaGpu *gpu = l->data;
|
|
|
f73620 |
|
|
|
f73620 |
if (meta_gpu_has_hotplug_mode_update (gpu))
|
|
|
f73620 |
return TRUE;
|
|
|
f73620 |
}
|
|
|
f73620 |
|
|
|
f73620 |
return FALSE;
|
|
|
f73620 |
}
|
|
|
f73620 |
|
|
|
f73620 |
static gboolean
|
|
|
f73620 |
should_use_stored_config (MetaMonitorManager *manager)
|
|
|
f73620 |
{
|
|
|
f73620 |
return (manager->in_init ||
|
|
|
f73620 |
!meta_monitor_manager_has_hotplug_mode_update (manager));
|
|
|
f73620 |
}
|
|
|
f73620 |
|
|
|
f73620 |
MetaMonitorsConfig *
|
|
|
f73620 |
meta_monitor_manager_ensure_configured (MetaMonitorManager *manager)
|
|
|
f73620 |
{
|
|
|
f73620 |
+ g_autoptr (MetaMonitorsConfig) initial_config = NULL;
|
|
|
f73620 |
MetaMonitorsConfig *config = NULL;
|
|
|
f73620 |
GError *error = NULL;
|
|
|
f73620 |
gboolean use_stored_config;
|
|
|
f73620 |
+ MetaMonitorsConfigKey *current_state_key;
|
|
|
f73620 |
MetaMonitorsConfigMethod method;
|
|
|
f73620 |
MetaMonitorsConfigMethod fallback_method =
|
|
|
f73620 |
META_MONITORS_CONFIG_METHOD_TEMPORARY;
|
|
|
f73620 |
|
|
|
f73620 |
use_stored_config = should_use_stored_config (manager);
|
|
|
f73620 |
if (use_stored_config)
|
|
|
f73620 |
method = META_MONITORS_CONFIG_METHOD_PERSISTENT;
|
|
|
f73620 |
else
|
|
|
f73620 |
method = META_MONITORS_CONFIG_METHOD_TEMPORARY;
|
|
|
f73620 |
|
|
|
f73620 |
+ initial_config = meta_monitor_config_manager_create_initial (manager->config_manager);
|
|
|
f73620 |
+
|
|
|
f73620 |
+ if (initial_config)
|
|
|
f73620 |
+ {
|
|
|
f73620 |
+ current_state_key = meta_create_monitors_config_key_for_current_state (manager);
|
|
|
f73620 |
+
|
|
|
f73620 |
+ /* don't ever reuse initial configuration, if the monitor topology changed
|
|
|
f73620 |
+ */
|
|
|
f73620 |
+ if (current_state_key && !meta_monitors_config_key_equal (current_state_key, initial_config->key))
|
|
|
f73620 |
+ g_clear_object (&initial_config);
|
|
|
f73620 |
+ }
|
|
|
f73620 |
+
|
|
|
f73620 |
if (use_stored_config)
|
|
|
f73620 |
{
|
|
|
f73620 |
config = meta_monitor_config_manager_get_stored (manager->config_manager);
|
|
|
f73620 |
if (config)
|
|
|
f73620 |
{
|
|
|
f73620 |
if (!meta_monitor_manager_apply_monitors_config (manager,
|
|
|
f73620 |
config,
|
|
|
f73620 |
method,
|
|
|
f73620 |
&error))
|
|
|
f73620 |
{
|
|
|
f73620 |
config = NULL;
|
|
|
f73620 |
g_warning ("Failed to use stored monitor configuration: %s",
|
|
|
f73620 |
error->message);
|
|
|
f73620 |
g_clear_error (&error);
|
|
|
f73620 |
}
|
|
|
f73620 |
else
|
|
|
f73620 |
{
|
|
|
f73620 |
g_object_ref (config);
|
|
|
f73620 |
goto done;
|
|
|
f73620 |
}
|
|
|
f73620 |
}
|
|
|
f73620 |
}
|
|
|
f73620 |
|
|
|
f73620 |
config = meta_monitor_config_manager_create_suggested (manager->config_manager);
|
|
|
f73620 |
if (config)
|
|
|
f73620 |
{
|
|
|
f73620 |
if (!meta_monitor_manager_apply_monitors_config (manager,
|
|
|
f73620 |
config,
|
|
|
f73620 |
method,
|
|
|
f73620 |
&error))
|
|
|
f73620 |
@@ -549,61 +563,61 @@ meta_monitor_manager_ensure_configured (MetaMonitorManager *manager)
|
|
|
f73620 |
{
|
|
|
f73620 |
goto done;
|
|
|
f73620 |
}
|
|
|
f73620 |
}
|
|
|
f73620 |
|
|
|
f73620 |
config = meta_monitor_config_manager_get_previous (manager->config_manager);
|
|
|
f73620 |
if (config)
|
|
|
f73620 |
{
|
|
|
f73620 |
config = g_object_ref (config);
|
|
|
f73620 |
|
|
|
f73620 |
if (meta_monitor_manager_is_config_complete (manager, config))
|
|
|
f73620 |
{
|
|
|
f73620 |
if (!meta_monitor_manager_apply_monitors_config (manager,
|
|
|
f73620 |
config,
|
|
|
f73620 |
method,
|
|
|
f73620 |
&error))
|
|
|
f73620 |
{
|
|
|
f73620 |
g_warning ("Failed to use suggested monitor configuration: %s",
|
|
|
f73620 |
error->message);
|
|
|
f73620 |
g_clear_error (&error);
|
|
|
f73620 |
}
|
|
|
f73620 |
else
|
|
|
f73620 |
{
|
|
|
f73620 |
goto done;
|
|
|
f73620 |
}
|
|
|
f73620 |
}
|
|
|
f73620 |
|
|
|
f73620 |
g_clear_object (&config);
|
|
|
f73620 |
}
|
|
|
f73620 |
|
|
|
f73620 |
- config = meta_monitor_config_manager_create_current (manager->config_manager);
|
|
|
f73620 |
+ config = g_steal_pointer (&initial_config);
|
|
|
f73620 |
if (config)
|
|
|
f73620 |
{
|
|
|
f73620 |
if (!meta_monitor_manager_apply_monitors_config (manager,
|
|
|
f73620 |
config,
|
|
|
f73620 |
method,
|
|
|
f73620 |
&error))
|
|
|
f73620 |
{
|
|
|
f73620 |
g_clear_object (&config);
|
|
|
f73620 |
g_warning ("Failed to use current monitor configuration: %s",
|
|
|
f73620 |
error->message);
|
|
|
f73620 |
g_clear_error (&error);
|
|
|
f73620 |
}
|
|
|
f73620 |
else
|
|
|
f73620 |
{
|
|
|
f73620 |
goto done;
|
|
|
f73620 |
}
|
|
|
f73620 |
}
|
|
|
f73620 |
|
|
|
f73620 |
config = meta_monitor_config_manager_create_linear (manager->config_manager);
|
|
|
f73620 |
if (config)
|
|
|
f73620 |
{
|
|
|
f73620 |
if (!meta_monitor_manager_apply_monitors_config (manager,
|
|
|
f73620 |
config,
|
|
|
f73620 |
method,
|
|
|
f73620 |
&error))
|
|
|
f73620 |
{
|
|
|
f73620 |
g_clear_object (&config);
|
|
|
f73620 |
g_warning ("Failed to use linear monitor configuration: %s",
|
|
|
f73620 |
error->message);
|
|
|
f73620 |
g_clear_error (&error);
|
|
|
f73620 |
--
|
|
|
f73620 |
2.17.1
|
|
|
f73620 |
|