[mutter] monitor-config-manager: Round layout size after scaling



commit 4786cc85bd3932da57f899da3a03f4729933f070
Author: Jonas Ådahl <jadahl gmail com>
Date:   Fri Oct 27 17:41:42 2017 +0800

    monitor-config-manager: Round layout size after scaling
    
    When calculating the logical monitor layout size given a scale, don't
    risk precision loss by float to int casting, which could result in a too
    small layout.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=765011

 src/backends/meta-monitor-config-manager.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/backends/meta-monitor-config-manager.c b/src/backends/meta-monitor-config-manager.c
index a3e92f2e7..431f1c1c3 100644
--- a/src/backends/meta-monitor-config-manager.c
+++ b/src/backends/meta-monitor-config-manager.c
@@ -545,8 +545,8 @@ create_preferred_logical_monitor_config (MetaMonitorManager          *monitor_ma
   switch (layout_mode)
     {
     case META_LOGICAL_MONITOR_LAYOUT_MODE_LOGICAL:
-      width /= scale;
-      height /= scale;
+      width = (int) roundf (width / scale);
+      height = (int) roundf (height / scale);
       break;
     case META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL:
       break;


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