Pop up menu in center, but do not rely on position: fixed.
[guacamole.git] / src / main / webapp / client.xhtml
index 71d519d..312d3c3 100644 (file)
 
         </div>
 
+        <!-- Keyboard event target for platforms with native OSKs -->
+        <textarea id="eventTarget"></textarea>
 
         <!-- Display -->
-        <div id="display" class="guac-display guac-loading">
+        <div id="display">
             
             <!-- Menu trigger -->
             <div id="menuControl"></div>
             </div>
         </div>
 
+        <!-- Touch-specific menu -->
+        <div id="touchMenu">
+            <img id="touchShowClipboard" src="images/menu-icons/tango/edit-paste.png"/>
+            <img id="touchShowKeyboard" src="images/menu-icons/tango/input-keyboard.png"/>
+            <img id="touchLogout" src="images/menu-icons/tango/system-log-out.png"/>
+        </div>
+
         <!-- guacamole-common-js scripts -->
         <script type="text/javascript" src="guacamole-common-js/keyboard.js"></script>
         <script type="text/javascript" src="guacamole-common-js/mouse.js"></script>
 
             // Start connect after control returns from onload (allow browser
             // to consider the page loaded).
-            document.body.onload = function() {
-
+            window.onload = function() {
                 window.setTimeout(function() {
+
+                    var tunnel;
+
+                    // If WebSocket available, try to use it.
+                    if (window.WebSocket)
+                        tunnel = new Guacamole.ChainedTunnel(
+                            new Guacamole.WebSocketTunnel("websocket-tunnel"),
+                            new Guacamole.HTTPTunnel("tunnel")
+                        );
+
+                    // If no WebSocket, then use HTTP.
+                    else
+                        tunnel = new Guacamole.HTTPTunnel("tunnel")
+
                     // Instantiate client
-                    var guac = new Guacamole.Client(
-                        GuacamoleUI.display,
-                        new Guacamole.HTTPTunnel("tunnel")
-                    );
+                    var guac = new Guacamole.Client(tunnel);
+
+                    // Add client to UI
+                    guac.getDisplay().className = "software-cursor";
+                    GuacamoleUI.display.appendChild(guac.getDisplay());
 
                     // Tie UI to client
                     GuacamoleUI.attach(guac);
 
                     try {
 
-                        // Get ID
-                        var id = window.location.search.substring(1);
+                        // Get entire query string, and pass to connect().
+                        // Normally, only the "id" parameter is required, but
+                        // all parameters should be preserved and passed on for
+                        // the sake of authentication.
 
-                        // Connect client
-                        guac.connect("id=" + id);
+                        var connect_string = window.location.search.substring(1);
+                        guac.connect(connect_string);
 
                     }
                     catch (e) {
                         GuacamoleUI.showError(e.message);
                     }
-                }, 0);
 
+                }, 0);
             };
 
         /* ]]> */ </script>