[mutter] monitor-config-manager: Reject a suggested config with gaps



commit be9e6dcc4f1af62ec1ab07b544818b7af1082f55
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Sat Mar 16 00:22:31 2019 +0100

    monitor-config-manager: Reject a suggested config with gaps
    
    It could happen that monitors suggest to use coordinates that don't take
    in consideration the scaling applied to one monitor, and such the
    generated configuration is not valid because not all the monitors are
    adjacent.
    
    So enforce this check before accepting a suggested configuration as it
    is.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/522>

 src/backends/meta-monitor-config-manager.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
---
diff --git a/src/backends/meta-monitor-config-manager.c b/src/backends/meta-monitor-config-manager.c
index 8b0b9f9b52..9de418a5d6 100644
--- a/src/backends/meta-monitor-config-manager.c
+++ b/src/backends/meta-monitor-config-manager.c
@@ -904,6 +904,21 @@ meta_monitor_config_manager_create_suggested (MetaMonitorConfigManager *config_m
       region = g_list_prepend (region, &logical_monitor_config->layout);
     }
 
+  for (l = region; region->next && l; l = l->next)
+    {
+      MetaRectangle *rect = l->data;
+
+      if (!meta_rectangle_is_adjacent_to_any_in_region (region, rect))
+        {
+          g_warning ("Suggested monitor config has monitors with no neighbors, "
+                     "rejecting");
+          g_list_free (region);
+          g_list_free_full (logical_monitor_configs,
+                            (GDestroyNotify) meta_logical_monitor_config_free);
+          return NULL;
+        }
+    }
+
   g_list_free (region);
 
   if (!logical_monitor_configs)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]