Merge 40654f2586 into 0ff97c1a24
This commit is contained in:
commit
044985185f
49
app/ui.js
49
app/ui.js
|
|
@ -38,7 +38,6 @@ var UI = {
|
||||||
controlbarMouseDownOffsetY: 0,
|
controlbarMouseDownOffsetY: 0,
|
||||||
|
|
||||||
isSafari: false,
|
isSafari: false,
|
||||||
rememberedClipSetting: null,
|
|
||||||
lastKeyboardinput: null,
|
lastKeyboardinput: null,
|
||||||
defaultKeyboardinputLen: 100,
|
defaultKeyboardinputLen: 100,
|
||||||
|
|
||||||
|
|
@ -172,7 +171,7 @@ var UI = {
|
||||||
UI.initSetting('port', port);
|
UI.initSetting('port', port);
|
||||||
UI.initSetting('encrypt', (window.location.protocol === "https:"));
|
UI.initSetting('encrypt', (window.location.protocol === "https:"));
|
||||||
UI.initSetting('cursor', !isTouchDevice);
|
UI.initSetting('cursor', !isTouchDevice);
|
||||||
UI.initSetting('clip', false);
|
UI.initSetting('view_clip', false);
|
||||||
UI.initSetting('resize', 'off');
|
UI.initSetting('resize', 'off');
|
||||||
UI.initSetting('shared', true);
|
UI.initSetting('shared', true);
|
||||||
UI.initSetting('view_only', false);
|
UI.initSetting('view_only', false);
|
||||||
|
|
@ -384,11 +383,13 @@ var UI = {
|
||||||
UI.addSettingChangeHandler('encrypt');
|
UI.addSettingChangeHandler('encrypt');
|
||||||
UI.addSettingChangeHandler('cursor');
|
UI.addSettingChangeHandler('cursor');
|
||||||
UI.addSettingChangeHandler('cursor', UI.updateLocalCursor);
|
UI.addSettingChangeHandler('cursor', UI.updateLocalCursor);
|
||||||
|
UI.addSettingChangeHandler('clipboard');
|
||||||
|
UI.addSettingChangeHandler('clipboard', UI.updateClipboard);
|
||||||
UI.addSettingChangeHandler('resize');
|
UI.addSettingChangeHandler('resize');
|
||||||
UI.addSettingChangeHandler('resize', UI.enableDisableViewClip);
|
UI.addSettingChangeHandler('resize', UI.enableDisableViewClip);
|
||||||
UI.addSettingChangeHandler('resize', UI.applyResizeMode);
|
UI.addSettingChangeHandler('resize', UI.applyResizeMode);
|
||||||
UI.addSettingChangeHandler('clip');
|
UI.addSettingChangeHandler('view_clip');
|
||||||
UI.addSettingChangeHandler('clip', UI.updateViewClip);
|
UI.addSettingChangeHandler('view_clip', UI.updateViewClip);
|
||||||
UI.addSettingChangeHandler('shared');
|
UI.addSettingChangeHandler('shared');
|
||||||
UI.addSettingChangeHandler('view_only');
|
UI.addSettingChangeHandler('view_only');
|
||||||
UI.addSettingChangeHandler('view_only', UI.updateViewOnly);
|
UI.addSettingChangeHandler('view_only', UI.updateViewOnly);
|
||||||
|
|
@ -893,7 +894,7 @@ var UI = {
|
||||||
UI.updateSetting('cursor', !isTouchDevice);
|
UI.updateSetting('cursor', !isTouchDevice);
|
||||||
UI.disableSetting('cursor');
|
UI.disableSetting('cursor');
|
||||||
}
|
}
|
||||||
UI.updateSetting('clip');
|
UI.updateSetting('view_clip');
|
||||||
UI.updateSetting('resize');
|
UI.updateSetting('resize');
|
||||||
UI.updateSetting('shared');
|
UI.updateSetting('shared');
|
||||||
UI.updateSetting('view_only');
|
UI.updateSetting('view_only');
|
||||||
|
|
@ -1003,23 +1004,43 @@ var UI = {
|
||||||
},
|
},
|
||||||
|
|
||||||
clipboardReceive: function(rfb, text) {
|
clipboardReceive: function(rfb, text) {
|
||||||
|
if (!UI.getSetting('clipboard')) return;
|
||||||
|
|
||||||
Log.Debug(">> UI.clipboardReceive: " + text.substr(0,40) + "...");
|
Log.Debug(">> UI.clipboardReceive: " + text.substr(0,40) + "...");
|
||||||
document.getElementById('noVNC_clipboard_text').value = text;
|
document.getElementById('noVNC_clipboard_text').value = text;
|
||||||
Log.Debug("<< UI.clipboardReceive");
|
Log.Debug("<< UI.clipboardReceive");
|
||||||
},
|
},
|
||||||
|
|
||||||
clipboardClear: function() {
|
clipboardClear: function() {
|
||||||
|
if (!UI.getSetting('clipboard')) return;
|
||||||
|
|
||||||
document.getElementById('noVNC_clipboard_text').value = "";
|
document.getElementById('noVNC_clipboard_text').value = "";
|
||||||
UI.rfb.clipboardPasteFrom("");
|
UI.rfb.clipboardPasteFrom("");
|
||||||
},
|
},
|
||||||
|
|
||||||
clipboardSend: function() {
|
clipboardSend: function() {
|
||||||
|
if (!UI.getSetting('clipboard')) return;
|
||||||
|
|
||||||
var text = document.getElementById('noVNC_clipboard_text').value;
|
var text = document.getElementById('noVNC_clipboard_text').value;
|
||||||
Log.Debug(">> UI.clipboardSend: " + text.substr(0,40) + "...");
|
Log.Debug(">> UI.clipboardSend: " + text.substr(0,40) + "...");
|
||||||
UI.rfb.clipboardPasteFrom(text);
|
UI.rfb.clipboardPasteFrom(text);
|
||||||
Log.Debug("<< UI.clipboardSend");
|
Log.Debug("<< UI.clipboardSend");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
updateClipboard: function() {
|
||||||
|
if (!UI.rfb) return;
|
||||||
|
|
||||||
|
var clipboard_enabled = UI.getSetting('clipboard');
|
||||||
|
var clipboard_button = document.getElementById('noVNC_clipboard_button');
|
||||||
|
if (clipboard_enabled) {
|
||||||
|
clipboard_button.disabled = false;
|
||||||
|
UI.rfb.set_clipboard(true);
|
||||||
|
} else {
|
||||||
|
clipboard_button.disabled = true;
|
||||||
|
UI.rfb.set_clipboard(false);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/* ------^-------
|
/* ------^-------
|
||||||
* /CLIPBOARD
|
* /CLIPBOARD
|
||||||
* ==============
|
* ==============
|
||||||
|
|
@ -1290,26 +1311,26 @@ var UI = {
|
||||||
/* ------^-------
|
/* ------^-------
|
||||||
* /RESIZE
|
* /RESIZE
|
||||||
* ==============
|
* ==============
|
||||||
* CLIPPING
|
* VIEW CLIPPING
|
||||||
* ------v------*/
|
* ------v------*/
|
||||||
|
|
||||||
// Set and configure viewport clipping
|
// Set and configure viewport clipping
|
||||||
setViewClip: function(clip) {
|
setViewClip: function(clip) {
|
||||||
UI.updateSetting('clip', clip);
|
UI.updateSetting('view_clip', clip);
|
||||||
UI.updateViewClip();
|
UI.updateViewClip();
|
||||||
},
|
},
|
||||||
|
|
||||||
// Update parameters that depend on the clip setting
|
// Update parameters that depend on the viewport clip setting
|
||||||
updateViewClip: function() {
|
updateViewClip: function() {
|
||||||
if (!UI.rfb) return;
|
if (!UI.rfb) return;
|
||||||
|
|
||||||
var display = UI.rfb.get_display();
|
var display = UI.rfb.get_display();
|
||||||
var cur_clip = display.get_viewport();
|
var cur_clip = display.get_viewport();
|
||||||
var new_clip = UI.getSetting('clip');
|
var new_clip = UI.getSetting('view_clip');
|
||||||
|
|
||||||
var resizeSetting = UI.getSetting('resize');
|
var resizeSetting = UI.getSetting('resize');
|
||||||
if (resizeSetting === 'downscale' || resizeSetting === 'scale') {
|
if (resizeSetting === 'downscale' || resizeSetting === 'scale') {
|
||||||
// Disable clipping if we are scaling
|
// Disable viewport clipping if we are scaling
|
||||||
new_clip = false;
|
new_clip = false;
|
||||||
} else if (isTouchDevice) {
|
} else if (isTouchDevice) {
|
||||||
// Touch devices usually have shit scrollbars
|
// Touch devices usually have shit scrollbars
|
||||||
|
|
@ -1334,20 +1355,20 @@ var UI = {
|
||||||
UI.updateViewDrag();
|
UI.updateViewDrag();
|
||||||
},
|
},
|
||||||
|
|
||||||
// Handle special cases where clipping is forced on/off or locked
|
// Handle special cases where viewport clipping is forced on/off or locked
|
||||||
enableDisableViewClip: function() {
|
enableDisableViewClip: function() {
|
||||||
var resizeSetting = UI.getSetting('resize');
|
var resizeSetting = UI.getSetting('resize');
|
||||||
// Disable clipping if we are scaling, connected or on touch
|
// Disable clipping if we are scaling, connected or on touch
|
||||||
if (resizeSetting === 'downscale' || resizeSetting === 'scale' ||
|
if (resizeSetting === 'downscale' || resizeSetting === 'scale' ||
|
||||||
isTouchDevice) {
|
isTouchDevice) {
|
||||||
UI.disableSetting('clip');
|
UI.disableSetting('view_clip');
|
||||||
} else {
|
} else {
|
||||||
UI.enableSetting('clip');
|
UI.enableSetting('view_clip');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/* ------^-------
|
/* ------^-------
|
||||||
* /CLIPPING
|
* /VIEW CLIPPING
|
||||||
* ==============
|
* ==============
|
||||||
* VIEWDRAG
|
* VIEWDRAG
|
||||||
* ------v------*/
|
* ------v------*/
|
||||||
|
|
|
||||||
11
core/rfb.js
11
core/rfb.js
|
|
@ -151,6 +151,7 @@ export default function RFB(defaults) {
|
||||||
'encrypt': false, // Use TLS/SSL/wss encryption
|
'encrypt': false, // Use TLS/SSL/wss encryption
|
||||||
'local_cursor': false, // Request locally rendered cursor
|
'local_cursor': false, // Request locally rendered cursor
|
||||||
'shared': true, // Request shared mode
|
'shared': true, // Request shared mode
|
||||||
|
'clipboard': true, // Synchronize server and client clipboard contents
|
||||||
'view_only': false, // Disable client mouse/keyboard
|
'view_only': false, // Disable client mouse/keyboard
|
||||||
'xvp_password_sep': '@', // Separator for XVP password fields
|
'xvp_password_sep': '@', // Separator for XVP password fields
|
||||||
'disconnectTimeout': 3, // Time (s) to wait for disconnection
|
'disconnectTimeout': 3, // Time (s) to wait for disconnection
|
||||||
|
|
@ -356,7 +357,12 @@ RFB.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
clipboardPasteFrom: function (text) {
|
clipboardPasteFrom: function (text) {
|
||||||
if (this._rfb_connection_state !== 'connected' || this._view_only) { return; }
|
if (this._rfb_connection_state !== 'connected' ||
|
||||||
|
this._view_only ||
|
||||||
|
!this._clipboard) {
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
RFB.messages.clientCutText(this._sock, text);
|
RFB.messages.clientCutText(this._sock, text);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -1167,7 +1173,7 @@ RFB.prototype = {
|
||||||
|
|
||||||
var text = this._sock.rQshiftStr(length);
|
var text = this._sock.rQshiftStr(length);
|
||||||
|
|
||||||
if (this._view_only) { return true; }
|
if (this._view_only || !this._clipboard) { return true; }
|
||||||
|
|
||||||
this._onClipboard(this, text);
|
this._onClipboard(this, text);
|
||||||
|
|
||||||
|
|
@ -1426,6 +1432,7 @@ make_properties(RFB, [
|
||||||
['encrypt', 'rw', 'bool'], // Use TLS/SSL/wss encryption
|
['encrypt', 'rw', 'bool'], // Use TLS/SSL/wss encryption
|
||||||
['local_cursor', 'rw', 'bool'], // Request locally rendered cursor
|
['local_cursor', 'rw', 'bool'], // Request locally rendered cursor
|
||||||
['shared', 'rw', 'bool'], // Request shared mode
|
['shared', 'rw', 'bool'], // Request shared mode
|
||||||
|
['clipboard', 'rw', 'bool'], // Synchronize server and client clipboard contents
|
||||||
['view_only', 'rw', 'bool'], // Disable client mouse/keyboard
|
['view_only', 'rw', 'bool'], // Disable client mouse/keyboard
|
||||||
['xvp_password_sep', 'rw', 'str'], // Separator for XVP password fields
|
['xvp_password_sep', 'rw', 'str'], // Separator for XVP password fields
|
||||||
['disconnectTimeout', 'rw', 'int'], // Time (s) to wait for disconnection
|
['disconnectTimeout', 'rw', 'int'], // Time (s) to wait for disconnection
|
||||||
|
|
|
||||||
5
vnc.html
5
vnc.html
|
|
@ -204,9 +204,12 @@
|
||||||
<li>
|
<li>
|
||||||
<label><input id="noVNC_setting_view_only" type="checkbox" /> View Only</label>
|
<label><input id="noVNC_setting_view_only" type="checkbox" /> View Only</label>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<label><input id="noVNC_setting_clipboard" type="checkbox" /> Clipboard</label>
|
||||||
|
</li>
|
||||||
<li><hr></li>
|
<li><hr></li>
|
||||||
<li>
|
<li>
|
||||||
<label><input id="noVNC_setting_clip" type="checkbox" /> Clip to Window</label>
|
<label><input id="noVNC_setting_view_clip" type="checkbox" /> Clip to Window</label>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<label for="noVNC_setting_resize">Scaling Mode:</label>
|
<label for="noVNC_setting_resize">Scaling Mode:</label>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue