[Spice-devel] [spice-html5][PATCH 11/12] resize_helper: round sizes down

Cédric Bosdonnat cbosdonnat at suse.com
Mon Feb 11 17:48:04 UTC 2019


If we round up, we may end up with a display slightly bigger than what
the window can have, thus adding scroll bars. When rounding down we
avoid this problems.
---
 src/resize.js | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/resize.js b/src/resize.js
index c8d87d9..b88666f 100644
--- a/src/resize.js
+++ b/src/resize.js
@@ -58,13 +58,13 @@ function resize_helper(sc)
     }
 
 
-    /* Xorg requires height be a multiple of 8; round up */
+    /* Xorg requires height be a multiple of 8; round down */
     if (h % 8 > 0)
-        h += (8 - (h % 8));
+        h -= (h % 8);
 
-    /* Xorg requires width be a multiple of 8; round up */
+    /* Xorg requires width be a multiple of 8; round down */
     if (w % 8 > 0)
-        w += (8 - (w % 8));
+        w -= (w % 8);
 
 
     sc.resize_window(0, w, h, 32, 0, 0);
-- 
2.19.2



More information about the Spice-devel mailing list