[PATCH spice-html5 3/3] Add checkbox to toggle debug console

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

 



This allows show or hide debug console under spice screen.
---
 resize.js  | 12 ++++++++++--
 spice.html | 18 ++++++++++++++++++
 2 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/resize.js b/resize.js
index 89b59ff..481b22f 100644
--- a/resize.js
+++ b/resize.js
@@ -44,8 +44,16 @@ function resize_helper(sc)
          at the bottom, and use the position of the message window
          to figure out how to resize */
 
-    /* Show both div elements - spice-area and message-div */
-    var h = window.innerHeight - m.offsetHeight - m.clientHeight - 20;
+    /* Screen height based on debug console visibility  */
+    if (window.getComputedStyle(m).getPropertyValue("display") == 'none')
+    {
+        var h = window.innerHeight - 70;
+    }
+    else
+    {
+        /* 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)
diff --git a/spice.html b/spice.html
index d4c9962..7abfcff 100644
--- a/spice.html
+++ b/spice.html
@@ -143,6 +143,23 @@
                 }
             }
 
+            function toggle_console()
+            {
+                var checkbox = document.getElementById('show_console');
+                var m = document.getElementById('message-div');
+
+                if (checkbox.checked)
+                {
+                    m.style.display = 'block';
+                }
+                else
+                {
+                    m.style.display = 'none';
+                }
+
+                window.addEventListener('resize', handle_resize);
+                resize_helper(sc);
+            }
             /* SPICE port event listeners
             window.addEventListener('spice-port-data', function(event) {
                 // Here we convert data to text, but really we can obtain binary data also
@@ -166,6 +183,7 @@
             <label for="host">Host:</label> <input type='text' id='host' value='localhost'> <!-- localhost -->
             <label for="port">Port:</label> <input type='text' id='port' value='5959'>
             <label for="password">Password:</label> <input type='password' id='password' value=''>
+            <label for="show_console">Show console </label><input type="checkbox" id="show_console" value="1" onchange="toggle_console()" checked>
             <button id="connectButton" onclick="connect();">Start</button>
         </div>
 
-- 
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]