[gnome-control-center] display: Round scaled logical monitor sizes the same way mutter does



commit a4a243cee4cef10b32fafc9d646cd5d2b7d75ec7
Author: Rui Matos <tiagomatos gmail com>
Date:   Mon Aug 28 17:45:42 2017 +0200

    display: Round scaled logical monitor sizes the same way mutter does
    
    Mutter uses round() while we are just truncating via the implicit
    double -> int type conversion, meaning that mutter will reject some
    configurations that should work. Fix that by using the same rounding
    as mutter.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=786919

 panels/display/cc-display-config-dbus.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/panels/display/cc-display-config-dbus.c b/panels/display/cc-display-config-dbus.c
index 16c1927..48e0145 100644
--- a/panels/display/cc-display-config-dbus.c
+++ b/panels/display/cc-display-config-dbus.c
@@ -17,6 +17,7 @@
  *
  */
 
+#include <math.h>
 #include <gio/gio.h>
 
 #include "cc-display-config-dbus.h"
@@ -1539,7 +1540,7 @@ logical_monitor_width (CcDisplayLogicalMonitor *lm)
     width = mode ? mode->width : 0;
 
   if (monitor->config->layout_mode == CC_DISPLAY_LAYOUT_MODE_LOGICAL)
-    return width / lm->scale;
+    return round (width / lm->scale);
   else
     return width;
 }
@@ -1569,7 +1570,7 @@ logical_monitor_height (CcDisplayLogicalMonitor *lm)
     height = mode ? mode->height : 0;
 
   if (monitor->config->layout_mode == CC_DISPLAY_LAYOUT_MODE_LOGICAL)
-    return height / lm->scale;
+    return round (height / lm->scale);
   else
     return height;
 }


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