[mutter] settings: Get UI scaling factor from primary logical monitor



commit eaf9ccde399f34d5f803583e0abd0a5bffe3e4f9
Author: Jonas Ådahl <jadahl gmail com>
Date:   Wed Oct 11 17:55:50 2017 +0800

    settings: Get UI scaling factor from primary logical monitor
    
    Don't use MAX(logical monitor scales) to determine the UI scaling
    factor, just use the primary logical monitor. That's where the shell UI
    will most likely be.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=788820

 src/backends/meta-settings.c |   21 ++++++---------------
 1 files changed, 6 insertions(+), 15 deletions(-)
---
diff --git a/src/backends/meta-settings.c b/src/backends/meta-settings.c
index cf66334..73741fd 100644
--- a/src/backends/meta-settings.c
+++ b/src/backends/meta-settings.c
@@ -67,23 +67,14 @@ calculate_ui_scaling_factor (MetaSettings *settings)
 {
   MetaMonitorManager *monitor_manager =
     meta_backend_get_monitor_manager (settings->backend);
-  GList *logical_monitors;
-  GList *l;
-  float max_scale = 1.0;
+  MetaLogicalMonitor *primary_logical_monitor;
 
-  logical_monitors =
-    meta_monitor_manager_get_logical_monitors (monitor_manager);
-  for (l = logical_monitors; l; l = l->next)
-    {
-      MetaLogicalMonitor *logical_monitor = l->data;
-
-      max_scale = MAX (meta_logical_monitor_get_scale (logical_monitor),
-                       max_scale);
-    }
-
-  g_warn_if_fail (fmodf (max_scale, 1.0) == 0.0);
+  primary_logical_monitor =
+    meta_monitor_manager_get_primary_logical_monitor (monitor_manager);
+  if (!primary_logical_monitor)
+    return 1;
 
-  return (int) max_scale;
+  return (int) meta_logical_monitor_get_scale (primary_logical_monitor);
 }
 
 static gboolean


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