From 9e087c20ae09fc449c4b261a838999a7ec64ee22 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 26 Feb 2013 14:17:13 -0800 Subject: [PATCH] Add "Raw Encoding" checkbox to Settings. This may be useful as a means to skip compression when network bandwidth is deemed irrelevant. --- include/rfb.js | 6 ++++++ include/ui.js | 5 +++++ vnc.html | 1 + 3 files changed, 12 insertions(+) diff --git a/include/rfb.js b/include/rfb.js index b7be99f8..b1f6d664 100644 --- a/include/rfb.js +++ b/include/rfb.js @@ -135,6 +135,7 @@ Util.conf_defaults(conf, that, defaults, [ ['encrypt', 'rw', 'bool', false, 'Use TLS/SSL/wss encryption'], ['true_color', 'rw', 'bool', true, 'Request true color pixel data'], + ['raw_encoding', 'rw', 'bool', false, 'Request raw pixel data'], ['local_cursor', 'rw', 'bool', false, 'Request locally rendered cursor'], ['shared', 'rw', 'bool', true, 'Request shared mode'], ['view_only', 'rw', 'bool', false, 'Disable client mouse/keyboard'], @@ -1674,6 +1675,11 @@ clientEncodings = function() { if ((encodings[i][0] === "Cursor") && (! conf.local_cursor)) { Util.Debug("Skipping Cursor pseudo-encoding"); + } else if ((encodings[i][0] === "RAW") && + (conf.raw_encoding)) { + encList.reverse() + encList.push(encodings[i][1]); + encList.reverse() // TODO: remove this when we have tight+non-true-color } else if ((encodings[i][0] === "TIGHT") && diff --git a/include/ui.js b/include/ui.js index 25bf162b..ac177a78 100644 --- a/include/ui.js +++ b/include/ui.js @@ -61,6 +61,7 @@ start: function(callback) { UI.initSetting('password', ''); UI.initSetting('encrypt', (window.location.protocol === "https:")); UI.initSetting('true_color', true); + UI.initSetting('raw_encoding', false); UI.initSetting('cursor', false); UI.initSetting('shared', true); UI.initSetting('view_only', false); @@ -312,6 +313,7 @@ toggleSettingsPanel: function() { } else { UI.updateSetting('encrypt'); UI.updateSetting('true_color'); + UI.updateSetting('raw_encoding'); if (UI.rfb.get_display().get_cursor_uri()) { UI.updateSetting('cursor'); } else { @@ -359,6 +361,7 @@ settingsApply: function() { //Util.Debug(">> settingsApply"); UI.saveSetting('encrypt'); UI.saveSetting('true_color'); + UI.saveSetting('raw_encoding') if (UI.rfb.get_display().get_cursor_uri()) { UI.saveSetting('cursor'); } @@ -471,6 +474,7 @@ updateVisualState: function() { //Util.Debug(">> updateVisualState"); $D('noVNC_encrypt').disabled = connected; $D('noVNC_true_color').disabled = connected; + $D('noVNC_raw_encoding').disabled = connected; if (UI.rfb && UI.rfb.get_display() && UI.rfb.get_display().get_cursor_uri()) { $D('noVNC_cursor').disabled = connected; @@ -541,6 +545,7 @@ connect: function() { UI.rfb.set_encrypt(UI.getSetting('encrypt')); UI.rfb.set_true_color(UI.getSetting('true_color')); + UI.rfb.set_raw_encoding(UI.getSetting('raw_encoding')); UI.rfb.set_local_cursor(UI.getSetting('cursor')); UI.rfb.set_shared(UI.getSetting('shared')); UI.rfb.set_view_only(UI.getSetting('view_only')); diff --git a/vnc.html b/vnc.html index 9d699c9e..2d9adbbc 100644 --- a/vnc.html +++ b/vnc.html @@ -118,6 +118,7 @@