[mutter] monitor-config-manager: Use helper to calculate mirroring scale



commit 71bf31da8379b19415d0a59d64bd06748fb3d3d6
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Thu Jun 23 12:48:57 2022 +0200

    monitor-config-manager: Use helper to calculate mirroring scale
    
    This will eventually help with better hueristics for finding a good
    scale. It currently doesn't change much, but the helper will later gain
    more functionality that will also help when coming up with mirroring
    configs.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2479>

 src/backends/meta-monitor-config-manager.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/src/backends/meta-monitor-config-manager.c b/src/backends/meta-monitor-config-manager.c
index f712e9c9a6..899ce00ab2 100644
--- a/src/backends/meta-monitor-config-manager.c
+++ b/src/backends/meta-monitor-config-manager.c
@@ -1169,6 +1169,7 @@ static MetaMonitorsConfig *
 create_for_switch_config_all_mirror (MetaMonitorConfigManager *config_manager)
 {
   MetaMonitorManager *monitor_manager = config_manager->monitor_manager;
+  MetaMonitor *primary_monitor;
   MetaLogicalMonitorLayoutMode layout_mode;
   MetaLogicalMonitorConfig *logical_monitor_config = NULL;
   GList *logical_monitor_configs;
@@ -1182,6 +1183,11 @@ create_for_switch_config_all_mirror (MetaMonitorConfigManager *config_manager)
   MetaMonitorsConfig *monitors_config;
   int width, height;
 
+  primary_monitor = find_primary_monitor (monitor_manager,
+                                          MONITOR_MATCH_ALLOW_FALLBACK);
+  if (!primary_monitor)
+    return NULL;
+
   layout_mode = meta_monitor_manager_get_default_layout_mode (monitor_manager);
   monitors = meta_monitor_manager_get_monitors (monitor_manager);
   monitor = monitors->data;
@@ -1255,9 +1261,8 @@ create_for_switch_config_all_mirror (MetaMonitorConfigManager *config_manager)
       if (!mode)
         continue;
 
-      scale = meta_monitor_manager_calculate_monitor_mode_scale (monitor_manager,
-                                                                 layout_mode,
-                                                                 monitor, mode);
+      scale = compute_scale_for_monitor (config_manager, monitor,
+                                         primary_monitor);
       best_scale = MAX (best_scale, scale);
       monitor_configs = g_list_prepend (monitor_configs, create_monitor_config (monitor, mode));
     }


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