This commit is contained in:
GitHub Merge Button 2011-11-14 22:37:05 -08:00
commit 526487f16f
4 changed files with 27 additions and 6 deletions

View File

@ -131,6 +131,7 @@ Util.conf_defaults(conf, that, defaults, [
['true_color', 'rw', 'bool', true, 'Request true color pixel data'], ['true_color', 'rw', 'bool', true, 'Request true color pixel data'],
['local_cursor', 'rw', 'bool', false, 'Request locally rendered cursor'], ['local_cursor', 'rw', 'bool', false, 'Request locally rendered cursor'],
['shared', 'rw', 'bool', true, 'Request shared mode'], ['shared', 'rw', 'bool', true, 'Request shared mode'],
['view_only', 'rw', 'bool', false, 'Disable client mouse/keyboard'],
['connectTimeout', 'rw', 'int', def_con_timeout, 'Time (s) to wait for connection'], ['connectTimeout', 'rw', 'int', def_con_timeout, 'Time (s) to wait for connection'],
['disconnectTimeout', 'rw', 'int', 3, 'Time (s) to wait for disconnection'], ['disconnectTimeout', 'rw', 'int', 3, 'Time (s) to wait for disconnection'],
@ -175,6 +176,22 @@ that.set_local_cursor = function(cursor) {
} }
}; };
that.set_view_only = function(enabled) {
if(!enabled) {
conf.view_only = false;
keyboard = new Keyboard({'target': conf.focusContainer,
'onKeyPress': keyPress});
mouse = new Mouse({'target': conf.target,
'onMouseButton': mouseButton,
'onMouseMove': mouseMove});
}
else {
conf.view_only = true;
keyboard = new Keyboard({'target': conf.focusContainer});
mouse = new Mouse({'target': conf.target});
}
};
// These are fake configuration getters // These are fake configuration getters
that.get_display = function() { return display; }; that.get_display = function() { return display; };
@ -207,11 +224,8 @@ function constructor() {
Util.Error("Display exception: " + exc); Util.Error("Display exception: " + exc);
updateState('fatal', "No working Display"); updateState('fatal', "No working Display");
} }
keyboard = new Keyboard({'target': conf.focusContainer,
'onKeyPress': keyPress}); that.set_view_only(conf.view_only);
mouse = new Mouse({'target': conf.target,
'onMouseButton': mouseButton,
'onMouseMove': mouseMove});
rmode = display.get_render_mode(); rmode = display.get_render_mode();
@ -1556,7 +1570,7 @@ that.sendPassword = function(passwd) {
}; };
that.sendCtrlAltDel = function() { that.sendCtrlAltDel = function() {
if (rfb_state !== "normal") { return false; } if (rfb_state !== "normal" || conf.view_only) { return false; }
Util.Info("Sending Ctrl-Alt-Del"); Util.Info("Sending Ctrl-Alt-Del");
var arr = []; var arr = [];
arr = arr.concat(keyEvent(0xFFE3, 1)); // Control arr = arr.concat(keyEvent(0xFFE3, 1)); // Control

View File

@ -52,6 +52,7 @@ load: function() {
UI.initSetting('true_color', true); UI.initSetting('true_color', true);
UI.initSetting('cursor', false); UI.initSetting('cursor', false);
UI.initSetting('shared', true); UI.initSetting('shared', true);
UI.initSetting('view_only',false);
UI.initSetting('connectTimeout', 2); UI.initSetting('connectTimeout', 2);
UI.initSetting('path', ''); UI.initSetting('path', '');
@ -252,6 +253,7 @@ toggleSettingsPanel: function() {
} }
UI.updateSetting('clip'); UI.updateSetting('clip');
UI.updateSetting('shared'); UI.updateSetting('shared');
UI.updateSetting('view_only');
UI.updateSetting('connectTimeout'); UI.updateSetting('connectTimeout');
UI.updateSetting('path'); UI.updateSetting('path');
UI.updateSetting('stylesheet'); UI.updateSetting('stylesheet');
@ -292,6 +294,7 @@ settingsApply: function() {
} }
UI.saveSetting('clip'); UI.saveSetting('clip');
UI.saveSetting('shared'); UI.saveSetting('shared');
UI.saveSetting('view_only');
UI.saveSetting('connectTimeout'); UI.saveSetting('connectTimeout');
UI.saveSetting('path'); UI.saveSetting('path');
UI.saveSetting('stylesheet'); UI.saveSetting('stylesheet');
@ -404,6 +407,7 @@ updateVisualState: function() {
$D('noVNC_cursor').disabled = true; $D('noVNC_cursor').disabled = true;
} }
$D('noVNC_shared').disabled = connected; $D('noVNC_shared').disabled = connected;
$D('noVNC_view_only').disabled = connected;
$D('noVNC_connectTimeout').disabled = connected; $D('noVNC_connectTimeout').disabled = connected;
$D('noVNC_path').disabled = connected; $D('noVNC_path').disabled = connected;
@ -463,6 +467,7 @@ connect: function() {
UI.rfb.set_encrypt(UI.getSetting('encrypt')); UI.rfb.set_encrypt(UI.getSetting('encrypt'));
UI.rfb.set_true_color(UI.getSetting('true_color')); UI.rfb.set_true_color(UI.getSetting('true_color'));
UI.rfb.set_local_cursor(UI.getSetting('cursor')); UI.rfb.set_local_cursor(UI.getSetting('cursor'));
UI.rfb.set_view_only(UI.getSetting('view_only'));
UI.rfb.set_shared(UI.getSetting('shared')); UI.rfb.set_shared(UI.getSetting('shared'));
UI.rfb.set_connectTimeout(UI.getSetting('connectTimeout')); UI.rfb.set_connectTimeout(UI.getSetting('connectTimeout'));

View File

@ -120,6 +120,7 @@
<li><input id="noVNC_cursor" type="checkbox"> Local Cursor</li> <li><input id="noVNC_cursor" type="checkbox"> Local Cursor</li>
<li><input id="noVNC_clip" type="checkbox"> Clip to window</li> <li><input id="noVNC_clip" type="checkbox"> Clip to window</li>
<li><input id="noVNC_shared" type="checkbox"> Shared Mode</li> <li><input id="noVNC_shared" type="checkbox"> Shared Mode</li>
<li><input id="noVNC_view_only" type="checkbox"> View Only</li>
<li><input id="noVNC_connectTimeout" type="input"> Connect Timeout (s)</li> <li><input id="noVNC_connectTimeout" type="input"> Connect Timeout (s)</li>
<li><input id="noVNC_path" type="input"> Path</li> <li><input id="noVNC_path" type="input"> Path</li>
<hr> <hr>

View File

@ -105,6 +105,7 @@
'true_color': WebUtil.getQueryVar('true_color', true), 'true_color': WebUtil.getQueryVar('true_color', true),
'local_cursor': WebUtil.getQueryVar('cursor', true), 'local_cursor': WebUtil.getQueryVar('cursor', true),
'shared': WebUtil.getQueryVar('shared', true), 'shared': WebUtil.getQueryVar('shared', true),
'view_only': WebUtil.getQueryVar('view_only',false),
'updateState': updateState, 'updateState': updateState,
'onPasswordRequired': passwordRequired}); 'onPasswordRequired': passwordRequired});
rfb.connect(host, port, password, path); rfb.connect(host, port, password, path);