implement ctrl-lock and alt-lock for vnc_auto.html
This commit is contained in:
parent
20d467cc50
commit
0cb3aa2a6c
|
|
@ -126,7 +126,12 @@ var that = {}, // Public API methods
|
|||
mouse_buttonMask = 0,
|
||||
mouse_arr = [],
|
||||
viewportDragging = false,
|
||||
viewportDragPos = {};
|
||||
viewportDragPos = {},
|
||||
|
||||
/* Soft key */
|
||||
wrapWithSoftKeyLock,
|
||||
softKeyState = {},
|
||||
softKey = { CtrlLock: 0xFFE3, AltLock: 0xFFE9 };
|
||||
|
||||
// Configuration attributes
|
||||
Util.conf_defaults(conf, that, defaults, [
|
||||
|
|
@ -596,12 +601,26 @@ checkEvents = function() {
|
|||
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) {
|
||||
var arr;
|
||||
|
||||
if (conf.view_only) { return; } // View only, skip keyboard events
|
||||
|
||||
arr = keyEvent(keysym, down);
|
||||
if (down) {
|
||||
arr = wrapWithSoftKeyLock(arr);
|
||||
}
|
||||
arr = arr.concat(fbUpdateRequests());
|
||||
ws.send(arr);
|
||||
};
|
||||
|
|
@ -1829,15 +1848,23 @@ that.sendKey = function(code, down) {
|
|||
if (typeof down !== 'undefined') {
|
||||
Util.Info("Sending key code (" + (down ? "down" : "up") + "): " + code);
|
||||
arr = arr.concat(keyEvent(code, down ? 1 : 0));
|
||||
if (down) {
|
||||
arr = wrapWithSoftKeyLock(arr);
|
||||
}
|
||||
} else {
|
||||
Util.Info("Sending key code (down + up): " + code);
|
||||
arr = arr.concat(keyEvent(code, 1));
|
||||
arr = wrapWithSoftKeyLock(arr);
|
||||
arr = arr.concat(keyEvent(code, 0));
|
||||
}
|
||||
arr = arr.concat(fbUpdateRequests());
|
||||
ws.send(arr);
|
||||
};
|
||||
|
||||
that.updateSoftKeyState = function(name, value) {
|
||||
softKeyState[name] = value;
|
||||
};
|
||||
|
||||
that.clipboardPasteFrom = function(text) {
|
||||
if (rfb_state !== "normal") { return; }
|
||||
//Util.Debug(">> clipboardPasteFrom: " + text.substr(0,40) + "...");
|
||||
|
|
|
|||
|
|
@ -25,7 +25,13 @@
|
|||
<div id="noVNC_status_bar" class="noVNC_status_bar" style="margin-top: 0px;">
|
||||
<table border=0 width="100%"><tr>
|
||||
<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"
|
||||
|
|
@ -50,6 +56,8 @@
|
|||
var rfb;
|
||||
|
||||
var buttons = [
|
||||
{name: 'ctrlLockCheckBox', onclick: updateSoftKeyState},
|
||||
{name: 'altLockCheckBox', onclick: updateSoftKeyState},
|
||||
{name: 'sendBackslashButton', onclick: function() {
|
||||
rfb.sendKey(0x5C);
|
||||
return false;
|
||||
|
|
@ -75,6 +83,10 @@
|
|||
rfb.sendCtrlAltDel();
|
||||
return false;
|
||||
}
|
||||
function updateSoftKeyState() {
|
||||
rfb.updateSoftKeyState(this.value, this.checked);
|
||||
return true;
|
||||
}
|
||||
function updateState(rfb, state, oldstate, msg) {
|
||||
var s, sb, level;
|
||||
s = $D('noVNC_status');
|
||||
|
|
|
|||
Loading…
Reference in New Issue