Renamed and moved keyboard and mouse functions

This commit is contained in:
samhed 2016-04-26 23:41:58 +02:00
parent 9e45354efc
commit fdf21468d3
1 changed files with 43 additions and 45 deletions

View File

@ -208,7 +208,7 @@ var UI;
$D("showKeyboard").onclick = UI.showKeyboard; $D("showKeyboard").onclick = UI.showKeyboard;
$D("keyboardinput").oninput = UI.keyInput; $D("keyboardinput").oninput = UI.keyInput;
$D("keyboardinput").onblur = UI.keyInputBlur; $D("keyboardinput").onblur = UI.hideKeyboard;
$D("keyboardinput").onsubmit = function () { return false; }; $D("keyboardinput").onsubmit = function () { return false; };
$D("toggleExtraKeysButton").onclick = UI.toggleExtraKeys; $D("toggleExtraKeysButton").onclick = UI.toggleExtraKeys;
@ -749,10 +749,6 @@ var UI;
return false; return false;
}, },
sendCtrlAltDel: function() {
UI.rfb.sendCtrlAltDel();
},
xvpShutdown: function() { xvpShutdown: function() {
UI.rfb.xvpShutdown(); UI.rfb.xvpShutdown();
}, },
@ -765,26 +761,6 @@ var UI;
UI.rfb.xvpReset(); 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 // Display the desktop name in the document title
updateDocumentTitle: function(rfb, name) { updateDocumentTitle: function(rfb, name) {
document.title = name + " - noVNC"; 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 // On touch devices, show the OS keyboard
showKeyboard: function() { showKeyboard: function() {
var kbi = $D('keyboardinput'); 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() { keepKeyboard: function() {
clearTimeout(UI.hideKeyboardTimeout); clearTimeout(UI.hideKeyboardTimeout);
if(UI.keyboardVisible === true) { 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() { toggleExtraKeys: function() {
UI.keepKeyboard(); UI.keepKeyboard();
if(UI.extraKeysVisible === false) { 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() { toggleCtrl: function() {
UI.keepKeyboard(); UI.keepKeyboard();
if(UI.ctrlOn === false) { if(UI.ctrlOn === false) {
@ -1201,18 +1209,8 @@ var UI;
} }
}, },
sendTab: function() { sendCtrlAltDel: function() {
UI.keepKeyboard(); UI.rfb.sendCtrlAltDel();
UI.rfb.sendKey(XK_Tab);
},
sendEsc: function() {
UI.keepKeyboard();
UI.rfb.sendKey(XK_Escape);
},
setKeyboard: function() {
UI.keyboardVisible = false;
}, },
//Helper to add options to dropdown. //Helper to add options to dropdown.