Merge 0cb3aa2a6c into 3516bdf3fa
This commit is contained in:
commit
3519267879
Binary file not shown.
|
After Width: | Height: | Size: 279 B |
|
|
@ -126,7 +126,12 @@ var that = {}, // Public API methods
|
||||||
mouse_buttonMask = 0,
|
mouse_buttonMask = 0,
|
||||||
mouse_arr = [],
|
mouse_arr = [],
|
||||||
viewportDragging = false,
|
viewportDragging = false,
|
||||||
viewportDragPos = {};
|
viewportDragPos = {},
|
||||||
|
|
||||||
|
/* Soft key */
|
||||||
|
wrapWithSoftKeyLock,
|
||||||
|
softKeyState = {},
|
||||||
|
softKey = { CtrlLock: 0xFFE3, AltLock: 0xFFE9 };
|
||||||
|
|
||||||
// Configuration attributes
|
// Configuration attributes
|
||||||
Util.conf_defaults(conf, that, defaults, [
|
Util.conf_defaults(conf, that, defaults, [
|
||||||
|
|
@ -596,12 +601,26 @@ checkEvents = function() {
|
||||||
setTimeout(checkEvents, conf.check_rate);
|
setTimeout(checkEvents, conf.check_rate);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
wrapWithSoftKeyLock = function(arr) {
|
||||||
|
var k;
|
||||||
|
for (k in softKeyState) {
|
||||||
|
if (softKeyState[k]) {
|
||||||
|
arr = keyEvent(softKey[k], 1).concat(arr);
|
||||||
|
arr = arr.concat(keyEvent(softKey[k], 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
|
||||||
keyPress = function(keysym, down) {
|
keyPress = function(keysym, down) {
|
||||||
var arr;
|
var arr;
|
||||||
|
|
||||||
if (conf.view_only) { return; } // View only, skip keyboard events
|
if (conf.view_only) { return; } // View only, skip keyboard events
|
||||||
|
|
||||||
arr = keyEvent(keysym, down);
|
arr = keyEvent(keysym, down);
|
||||||
|
if (down) {
|
||||||
|
arr = wrapWithSoftKeyLock(arr);
|
||||||
|
}
|
||||||
arr = arr.concat(fbUpdateRequests());
|
arr = arr.concat(fbUpdateRequests());
|
||||||
ws.send(arr);
|
ws.send(arr);
|
||||||
};
|
};
|
||||||
|
|
@ -1829,15 +1848,23 @@ that.sendKey = function(code, down) {
|
||||||
if (typeof down !== 'undefined') {
|
if (typeof down !== 'undefined') {
|
||||||
Util.Info("Sending key code (" + (down ? "down" : "up") + "): " + code);
|
Util.Info("Sending key code (" + (down ? "down" : "up") + "): " + code);
|
||||||
arr = arr.concat(keyEvent(code, down ? 1 : 0));
|
arr = arr.concat(keyEvent(code, down ? 1 : 0));
|
||||||
|
if (down) {
|
||||||
|
arr = wrapWithSoftKeyLock(arr);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Util.Info("Sending key code (down + up): " + code);
|
Util.Info("Sending key code (down + up): " + code);
|
||||||
arr = arr.concat(keyEvent(code, 1));
|
arr = arr.concat(keyEvent(code, 1));
|
||||||
|
arr = wrapWithSoftKeyLock(arr);
|
||||||
arr = arr.concat(keyEvent(code, 0));
|
arr = arr.concat(keyEvent(code, 0));
|
||||||
}
|
}
|
||||||
arr = arr.concat(fbUpdateRequests());
|
arr = arr.concat(fbUpdateRequests());
|
||||||
ws.send(arr);
|
ws.send(arr);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
that.updateSoftKeyState = function(name, value) {
|
||||||
|
softKeyState[name] = value;
|
||||||
|
};
|
||||||
|
|
||||||
that.clipboardPasteFrom = function(text) {
|
that.clipboardPasteFrom = function(text) {
|
||||||
if (rfb_state !== "normal") { return; }
|
if (rfb_state !== "normal") { return; }
|
||||||
//Util.Debug(">> clipboardPasteFrom: " + text.substr(0,40) + "...");
|
//Util.Debug(">> clipboardPasteFrom: " + text.substr(0,40) + "...");
|
||||||
|
|
|
||||||
|
|
@ -143,6 +143,7 @@ addMouseHandlers: function() {
|
||||||
//$D("keyboardinput").onkeydown = function (event) { onKeyDown(event); };
|
//$D("keyboardinput").onkeydown = function (event) { onKeyDown(event); };
|
||||||
$D("keyboardinput").onblur = UI.keyInputBlur;
|
$D("keyboardinput").onblur = UI.keyInputBlur;
|
||||||
|
|
||||||
|
$D("sendBackslashButton").onclick = UI.sendBackslash;
|
||||||
$D("sendCtrlAltDelButton").onclick = UI.sendCtrlAltDel;
|
$D("sendCtrlAltDelButton").onclick = UI.sendCtrlAltDel;
|
||||||
$D("clipboardButton").onclick = UI.toggleClipboardPanel;
|
$D("clipboardButton").onclick = UI.toggleClipboardPanel;
|
||||||
$D("settingsButton").onclick = UI.toggleSettingsPanel;
|
$D("settingsButton").onclick = UI.toggleSettingsPanel;
|
||||||
|
|
@ -391,6 +392,11 @@ setPassword: function() {
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
sendBackslash: function() {
|
||||||
|
UI.rfb.sendKey(0x5C);
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
sendCtrlAltDel: function() {
|
sendCtrlAltDel: function() {
|
||||||
UI.rfb.sendCtrlAltDel();
|
UI.rfb.sendCtrlAltDel();
|
||||||
},
|
},
|
||||||
|
|
@ -489,11 +495,13 @@ updateVisualState: function() {
|
||||||
UI.setMouseButton(1);
|
UI.setMouseButton(1);
|
||||||
$D('clipboardButton').style.display = "inline";
|
$D('clipboardButton').style.display = "inline";
|
||||||
$D('showKeyboard').style.display = "inline";
|
$D('showKeyboard').style.display = "inline";
|
||||||
|
$D('sendBackslashButton').style.display = "inline";
|
||||||
$D('sendCtrlAltDelButton').style.display = "inline";
|
$D('sendCtrlAltDelButton').style.display = "inline";
|
||||||
} else {
|
} else {
|
||||||
UI.setMouseButton();
|
UI.setMouseButton();
|
||||||
$D('clipboardButton').style.display = "none";
|
$D('clipboardButton').style.display = "none";
|
||||||
$D('showKeyboard').style.display = "none";
|
$D('showKeyboard').style.display = "none";
|
||||||
|
$D('sendBackslashButton').style.display = "none";
|
||||||
$D('sendCtrlAltDelButton').style.display = "none";
|
$D('sendCtrlAltDelButton').style.display = "none";
|
||||||
}
|
}
|
||||||
// State change disables viewport dragging.
|
// State change disables viewport dragging.
|
||||||
|
|
|
||||||
3
vnc.html
3
vnc.html
|
|
@ -70,6 +70,9 @@
|
||||||
|
|
||||||
<!--noVNC Buttons-->
|
<!--noVNC Buttons-->
|
||||||
<div class="noVNC-buttons-right">
|
<div class="noVNC-buttons-right">
|
||||||
|
<input type="image" src="images/backslash.png"
|
||||||
|
id="sendBackslashButton" class="noVNC_status_button"
|
||||||
|
title="Send Backslash" />
|
||||||
<input type="image" src="images/ctrlaltdel.png"
|
<input type="image" src="images/ctrlaltdel.png"
|
||||||
id="sendCtrlAltDelButton" class="noVNC_status_button"
|
id="sendCtrlAltDelButton" class="noVNC_status_button"
|
||||||
title="Send Ctrl-Alt-Del" />
|
title="Send Ctrl-Alt-Del" />
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,15 @@
|
||||||
<div id="noVNC_status_bar" class="noVNC_status_bar" style="margin-top: 0px;">
|
<div id="noVNC_status_bar" class="noVNC_status_bar" style="margin-top: 0px;">
|
||||||
<table border=0 width="100%"><tr>
|
<table border=0 width="100%"><tr>
|
||||||
<td><div id="noVNC_status">Loading</div></td>
|
<td><div id="noVNC_status">Loading</div></td>
|
||||||
<td width="1%"><div id="noVNC_buttons">
|
<td width="350pt"><div id="noVNC_buttons">
|
||||||
|
<input type=checkbox value="CtrlLock"
|
||||||
|
id="ctrlLockCheckBox">
|
||||||
|
<label for="ctrlLockCheckBox">CtrlLock</label>
|
||||||
|
<input type=checkbox value="AltLock"
|
||||||
|
id="altLockCheckBox">
|
||||||
|
<label for="altLockCheckBox">AltLock</label>
|
||||||
|
<input type=button value="Send Backslash"
|
||||||
|
id="sendBackslashButton">
|
||||||
<input type=button value="Send CtrlAltDel"
|
<input type=button value="Send CtrlAltDel"
|
||||||
id="sendCtrlAltDelButton">
|
id="sendCtrlAltDelButton">
|
||||||
</div></td>
|
</div></td>
|
||||||
|
|
@ -47,6 +55,16 @@
|
||||||
|
|
||||||
var rfb;
|
var rfb;
|
||||||
|
|
||||||
|
var buttons = [
|
||||||
|
{name: 'ctrlLockCheckBox', onclick: updateSoftKeyState},
|
||||||
|
{name: 'altLockCheckBox', onclick: updateSoftKeyState},
|
||||||
|
{name: 'sendBackslashButton', onclick: function() {
|
||||||
|
rfb.sendKey(0x5C);
|
||||||
|
return false;
|
||||||
|
}},
|
||||||
|
{name: 'sendCtrlAltDelButton', onclick: sendCtrlAltDel}
|
||||||
|
];
|
||||||
|
|
||||||
function passwordRequired(rfb) {
|
function passwordRequired(rfb) {
|
||||||
var msg;
|
var msg;
|
||||||
msg = '<form onsubmit="return setPassword();"';
|
msg = '<form onsubmit="return setPassword();"';
|
||||||
|
|
@ -65,11 +83,14 @@
|
||||||
rfb.sendCtrlAltDel();
|
rfb.sendCtrlAltDel();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
function updateSoftKeyState() {
|
||||||
|
rfb.updateSoftKeyState(this.value, this.checked);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
function updateState(rfb, state, oldstate, msg) {
|
function updateState(rfb, state, oldstate, msg) {
|
||||||
var s, sb, cad, level;
|
var s, sb, level;
|
||||||
s = $D('noVNC_status');
|
s = $D('noVNC_status');
|
||||||
sb = $D('noVNC_status_bar');
|
sb = $D('noVNC_status_bar');
|
||||||
cad = $D('sendCtrlAltDelButton');
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case 'failed': level = "error"; break;
|
case 'failed': level = "error"; break;
|
||||||
case 'fatal': level = "error"; break;
|
case 'fatal': level = "error"; break;
|
||||||
|
|
@ -79,8 +100,15 @@
|
||||||
default: level = "warn"; break;
|
default: level = "warn"; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state === "normal") { cad.disabled = false; }
|
var i;
|
||||||
else { cad.disabled = true; }
|
for (i = 0; i < buttons.length; i++) {
|
||||||
|
var elem = $D(buttons[i].name);
|
||||||
|
if (state === "normal") {
|
||||||
|
elem.disabled = false;
|
||||||
|
} else {
|
||||||
|
elem.disabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (typeof(msg) !== 'undefined') {
|
if (typeof(msg) !== 'undefined') {
|
||||||
sb.setAttribute("class", "noVNC_status_" + level);
|
sb.setAttribute("class", "noVNC_status_" + level);
|
||||||
|
|
@ -91,8 +119,12 @@
|
||||||
window.onscriptsload = function () {
|
window.onscriptsload = function () {
|
||||||
var host, port, password, path, token;
|
var host, port, password, path, token;
|
||||||
|
|
||||||
$D('sendCtrlAltDelButton').style.display = "inline";
|
var i;
|
||||||
$D('sendCtrlAltDelButton').onclick = sendCtrlAltDel;
|
for (i = 0; i < buttons.length; i++) {
|
||||||
|
var button = buttons[i];
|
||||||
|
$D(button.name).style.display = "inline";
|
||||||
|
$D(button.name).onclick = button.onclick;
|
||||||
|
}
|
||||||
|
|
||||||
WebUtil.init_logging(WebUtil.getQueryVar('logging', 'warn'));
|
WebUtil.init_logging(WebUtil.getQueryVar('logging', 'warn'));
|
||||||
document.title = unescape(WebUtil.getQueryVar('title', 'noVNC'));
|
document.title = unescape(WebUtil.getQueryVar('title', 'noVNC'));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue