[PATCH spice-html5 2/2] Make sure to not set to smaller height than is minimal

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

 



Get minimal  screen height from css file.
---
 resize.js | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/resize.js b/resize.js
index b572de7..89b59ff 100644
--- a/resize.js
+++ b/resize.js
@@ -32,9 +32,14 @@
 **--------------------------------------------------------------------------*/
 function resize_helper(sc)
 {
-    var w = document.getElementById(sc.screen_id).clientWidth;
+    var screen_id = document.getElementById(sc.screen_id);
+    var w = screen_id.clientWidth;
     var m = document.getElementById(sc.message_id);
 
+    /* Screen size can't be get from screen_id.style.minHeight, min-height is defined in css */
+    var minHeight = parseInt(window.getComputedStyle(screen_id).getPropertyValue("min-height"),
+                             10);
+
     /* Resize vertically; basically we leave a 20 pixel margin
          at the bottom, and use the position of the message window
          to figure out how to resize */
@@ -42,6 +47,9 @@ function resize_helper(sc)
     /* Show both div elements - spice-area and message-div */
     var h = window.innerHeight - m.offsetHeight - m.clientHeight - 20;
 
+    /* Set minimal height if screen is smaller than screen min-height */
+    if (h < minHeight)
+        h = minHeight;
 
     /* Xorg requires height be a multiple of 8; round up */
     if (h % 8 > 0)
@@ -51,7 +59,6 @@ function resize_helper(sc)
     if (w % 8 > 0)
         w += (8 - (w % 8));
 
-
     sc.resize_window(0, w, h, 32, 0, 0);
     sc.spice_resize_timer = undefined;
 }
-- 
2.9.4

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]