]> git.proxmox.com Git - mirror_novnc.git/commitdiff
Renamed and moved keyboard and mouse functions
authorsamhed <samuel@cendio.se>
Tue, 26 Apr 2016 21:41:58 +0000 (23:41 +0200)
committersamhed <samuel@cendio.se>
Thu, 12 May 2016 14:56:50 +0000 (16:56 +0200)
include/ui.js

index 23157728ad1a3e3fd88a52d94abd57e27610aa39..db0b3c1799523ab5a4218d4777c1f9056a105844 100644 (file)
@@ -208,7 +208,7 @@ var UI;
             $D("showKeyboard").onclick = UI.showKeyboard;
 
             $D("keyboardinput").oninput = UI.keyInput;
-            $D("keyboardinput").onblur = UI.keyInputBlur;
+            $D("keyboardinput").onblur = UI.hideKeyboard;
             $D("keyboardinput").onsubmit = function () { return false; };
 
             $D("toggleExtraKeysButton").onclick = UI.toggleExtraKeys;
@@ -749,10 +749,6 @@ var UI;
             return false;
         },
 
-        sendCtrlAltDel: function() {
-            UI.rfb.sendCtrlAltDel();
-        },
-
         xvpShutdown: function() {
             UI.rfb.xvpShutdown();
         },
@@ -765,26 +761,6 @@ var UI;
             UI.rfb.xvpReset();
         },
 
-        setMouseButton: function(num) {
-            if (typeof num === 'undefined') {
-                // Disable mouse buttons
-                num = -1;
-            }
-            if (UI.rfb) {
-                UI.rfb.get_mouse().set_touchButton(num);
-            }
-
-            var blist = [0, 1,2,4];
-            for (var b = 0; b < blist.length; b++) {
-                var button = $D('noVNC_mouse_button' + blist[b]);
-                if (blist[b] === num) {
-                    button.style.display = "";
-                } else {
-                    button.style.display = "none";
-                }
-            }
-        },
-
         // Display the desktop name in the document title
         updateDocumentTitle: function(rfb, name) {
             document.title = name + " - noVNC";
@@ -1042,6 +1018,26 @@ var UI;
             }
         },
 
+        setMouseButton: function(num) {
+            if (typeof num === 'undefined') {
+                // Disable mouse buttons
+                num = -1;
+            }
+            if (UI.rfb) {
+                UI.rfb.get_mouse().set_touchButton(num);
+            }
+
+            var blist = [0, 1,2,4];
+            for (var b = 0; b < blist.length; b++) {
+                var button = $D('noVNC_mouse_button' + blist[b]);
+                if (blist[b] === num) {
+                    button.style.display = "";
+                } else {
+                    button.style.display = "none";
+                }
+            }
+        },
+
         // On touch devices, show the OS keyboard
         showKeyboard: function() {
             var kbi = $D('keyboardinput');
@@ -1060,6 +1056,16 @@ var UI;
             }
         },
 
+        hideKeyboard: function() {
+            $D('showKeyboard').className = "noVNC_status_button";
+            //Weird bug in iOS if you change keyboardVisible
+            //here it does not actually occur so next time
+            //you click keyboard icon it doesnt work.
+            UI.hideKeyboardTimeout = setTimeout(function() {
+                UI.keyboardVisible = false;
+            },100);
+        },
+
         keepKeyboard: function() {
             clearTimeout(UI.hideKeyboardTimeout);
             if(UI.keyboardVisible === true) {
@@ -1148,14 +1154,6 @@ var UI;
             }
         },
 
-        keyInputBlur: function() {
-            $D('showKeyboard').className = "noVNC_status_button";
-            //Weird bug in iOS if you change keyboardVisible
-            //here it does not actually occur so next time
-            //you click keyboard icon it doesnt work.
-            UI.hideKeyboardTimeout = setTimeout(function() { UI.setKeyboard(); },100);
-        },
-
         toggleExtraKeys: function() {
             UI.keepKeyboard();
             if(UI.extraKeysVisible === false) {
@@ -1175,6 +1173,16 @@ var UI;
             }
         },
 
+        sendEsc: function() {
+            UI.keepKeyboard();
+            UI.rfb.sendKey(XK_Escape);
+        },
+
+        sendTab: function() {
+            UI.keepKeyboard();
+            UI.rfb.sendKey(XK_Tab);
+        },
+
         toggleCtrl: function() {
             UI.keepKeyboard();
             if(UI.ctrlOn === false) {
@@ -1201,18 +1209,8 @@ var UI;
             }
         },
 
-        sendTab: function() {
-            UI.keepKeyboard();
-            UI.rfb.sendKey(XK_Tab);
-        },
-
-        sendEsc: function() {
-            UI.keepKeyboard();
-            UI.rfb.sendKey(XK_Escape);
-        },
-
-        setKeyboard: function() {
-            UI.keyboardVisible = false;
+        sendCtrlAltDel: function() {
+            UI.rfb.sendCtrlAltDel();
         },
 
         //Helper to add options to dropdown.