From 7eaeba520ac8ab19975e3f96150a9cd4f26a8f30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Tue, 14 Feb 2017 19:43:10 +0800 Subject: [PATCH] monitor-config-manager: Verify monitor modes in logical monitor config Verify that each monitor in a logical monitor has the same dimensions, i.e. that it they all fill out the same logical monitor space. https://bugzilla.gnome.org/show_bug.cgi?id=777732 --- src/backends/meta-monitor-config-manager.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/backends/meta-monitor-config-manager.c b/src/backends/meta-monitor-config-manager.c index 6996cd76e..d64c700d2 100644 --- a/src/backends/meta-monitor-config-manager.c +++ b/src/backends/meta-monitor-config-manager.c @@ -865,6 +865,10 @@ gboolean meta_verify_logical_monitor_config (MetaLogicalMonitorConfig *logical_monitor_config, GError **error) { + GList *l; + int layout_width; + int layout_height; + if (logical_monitor_config->scale < 1) { g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, @@ -890,6 +894,21 @@ meta_verify_logical_monitor_config (MetaLogicalMonitorConfig *logical_monitor_co return FALSE; } + layout_width = logical_monitor_config->layout.width; + layout_height = logical_monitor_config->layout.height; + for (l = logical_monitor_config->monitor_configs; l; l = l->next) + { + MetaMonitorConfig *monitor_config = l->data; + + if (monitor_config->mode_spec->width != layout_width || + monitor_config->mode_spec->height != layout_height) + { + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, + "Monitor modes in logical monitor conflict"); + return FALSE; + } + } + return TRUE; }