浏览代码

Expose VNC shared mode setting in UIs.

If shared mode is false, then the server should disconnect other
connections before the current connection is allowed to proceed.
Joel Martin 14 年之前
父节点
当前提交
f1a9971c82
共有 4 个文件被更改,包括 13 次插入8 次删除
  1. 0 3
      docs/TODO
  2. 7 0
      include/default_controls.js
  3. 2 2
      include/rfb.js
  4. 4 3
      vnc_auto.html

+ 0 - 3
docs/TODO

@@ -6,8 +6,6 @@ Short Term:
 
 
 - Test on IE 9 preview 3.
 - Test on IE 9 preview 3.
 
 
-- Test firefox 4
-
 - Fix cursor URI detection in Arora:
 - Fix cursor URI detection in Arora:
     - allows data URI, but doesn't actually work
     - allows data URI, but doesn't actually work
 
 
@@ -22,7 +20,6 @@ Medium Term:
     - Configuration menu:
     - Configuration menu:
         - Tunable: speed vs. bandwidth selection
         - Tunable: speed vs. bandwidth selection
         - Tunable: CPU use versus latency.
         - Tunable: CPU use versus latency.
-        - shared mode
         - Scaling
         - Scaling
 
 
     - Keyboard menu:
     - Keyboard menu:

+ 7 - 0
include/default_controls.js

@@ -49,6 +49,8 @@ load: function(target) {
     html += '                type="checkbox" checked> True Color</li>';
     html += '                type="checkbox" checked> True Color</li>';
     html += '            <li><input id="VNC_cursor"';
     html += '            <li><input id="VNC_cursor"';
     html += '                type="checkbox"> Local Cursor</li>';
     html += '                type="checkbox"> Local Cursor</li>';
+    html += '            <li><input id="VNC_shared"';
+    html += '                type="checkbox"> Shared Mode</li>';
     html += '            <li><input id="VNC_connectTimeout"';
     html += '            <li><input id="VNC_connectTimeout"';
     html += '                type="input"> Connect Timeout (s)</li>';
     html += '                type="input"> Connect Timeout (s)</li>';
     html += '            <hr>';
     html += '            <hr>';
@@ -115,6 +117,7 @@ load: function(target) {
     DC.initSetting('encrypt', false);
     DC.initSetting('encrypt', false);
     DC.initSetting('true_color', true);
     DC.initSetting('true_color', true);
     DC.initSetting('cursor', false);
     DC.initSetting('cursor', false);
+    DC.initSetting('shared', true);
     DC.initSetting('connectTimeout', 2);
     DC.initSetting('connectTimeout', 2);
 
 
     DC.rfb = RFB({'target': 'VNC_canvas',
     DC.rfb = RFB({'target': 'VNC_canvas',
@@ -218,6 +221,7 @@ clickSettingsMenu: function() {
             DC.updateSetting('cursor', false);
             DC.updateSetting('cursor', false);
             $('VNC_cursor').disabled = true;
             $('VNC_cursor').disabled = true;
         }
         }
+        DC.updateSetting('shared');
         DC.updateSetting('connectTimeout');
         DC.updateSetting('connectTimeout');
         DC.updateSetting('stylesheet');
         DC.updateSetting('stylesheet');
         DC.updateSetting('logging');
         DC.updateSetting('logging');
@@ -249,6 +253,7 @@ settingsDisabled: function(disabled, rfb) {
         DefaultControls.updateSetting('cursor', false);
         DefaultControls.updateSetting('cursor', false);
         $('VNC_cursor').disabled = true;
         $('VNC_cursor').disabled = true;
     }
     }
+    $('VNC_shared').disabled = disabled;
     $('VNC_connectTimeout').disabled = disabled;
     $('VNC_connectTimeout').disabled = disabled;
     //Util.Debug("<< settingsDisabled");
     //Util.Debug("<< settingsDisabled");
 },
 },
@@ -262,6 +267,7 @@ settingsApply: function() {
     if (DC.rfb.get_canvas().get_cursor_uri()) {
     if (DC.rfb.get_canvas().get_cursor_uri()) {
         DC.saveSetting('cursor');
         DC.saveSetting('cursor');
     }
     }
+    DC.saveSetting('shared');
     DC.saveSetting('connectTimeout');
     DC.saveSetting('connectTimeout');
     DC.saveSetting('stylesheet');
     DC.saveSetting('stylesheet');
     DC.saveSetting('logging');
     DC.saveSetting('logging');
@@ -363,6 +369,7 @@ connect: function() {
     DC.rfb.set_encrypt(DC.getSetting('encrypt'));
     DC.rfb.set_encrypt(DC.getSetting('encrypt'));
     DC.rfb.set_true_color(DC.getSetting('true_color'));
     DC.rfb.set_true_color(DC.getSetting('true_color'));
     DC.rfb.set_local_cursor(DC.getSetting('cursor'));
     DC.rfb.set_local_cursor(DC.getSetting('cursor'));
+    DC.rfb.set_shared(DC.getSetting('shared'));
     DC.rfb.set_connectTimeout(DC.getSetting('connectTimeout'));
     DC.rfb.set_connectTimeout(DC.getSetting('connectTimeout'));
 
 
     DC.rfb.connect(host, port, password);
     DC.rfb.connect(host, port, password);

+ 2 - 2
include/rfb.js

@@ -39,7 +39,6 @@ var that           = {},         // Public API interface
     rfb_version    = 0,
     rfb_version    = 0,
     rfb_max_version= 3.8,
     rfb_max_version= 3.8,
     rfb_auth_scheme= '',
     rfb_auth_scheme= '',
-    rfb_shared     = 1,
 
 
 
 
     // In preference order
     // In preference order
@@ -134,6 +133,7 @@ cdef('focusContainer', 'dom', document, 'Area that traps keyboard input');
 cdef('encrypt',        'bool', false, 'Use TLS/SSL/wss encryption');
 cdef('encrypt',        'bool', false, 'Use TLS/SSL/wss encryption');
 cdef('true_color',     'bool', true,  'Request true color pixel data');
 cdef('true_color',     'bool', true,  'Request true color pixel data');
 cdef('local_cursor',   'bool', false, 'Request locally rendered cursor');
 cdef('local_cursor',   'bool', false, 'Request locally rendered cursor');
+cdef('shared',         'bool', true,  'Request shared mode');
 
 
 cdef('connectTimeout',    'int', 2,    'Time (s) to wait for connection');
 cdef('connectTimeout',    'int', 2,    'Time (s) to wait for connection');
 cdef('disconnectTimeout', 'int', 3,    'Time (s) to wait for disconnection');
 cdef('disconnectTimeout', 'int', 3,    'Time (s) to wait for disconnection');
@@ -826,7 +826,7 @@ init_msg = function() {
             case 2:  // too-many
             case 2:  // too-many
                 return fail("Too many auth attempts");
                 return fail("Too many auth attempts");
         }
         }
-        send_array([rfb_shared]); // ClientInitialisation
+        send_array([conf.shared ? 1 : 0]); // ClientInitialisation
         break;
         break;
 
 
     case 'ServerInitialisation' :
     case 'ServerInitialisation' :

+ 4 - 3
vnc_auto.html

@@ -101,9 +101,10 @@
             }
             }
 
 
             rfb = new RFB({'encrypt':      WebUtil.getQueryVar('encrypt', false),
             rfb = new RFB({'encrypt':      WebUtil.getQueryVar('encrypt', false),
-                       'true_color':   WebUtil.getQueryVar('true_color', true),
-                       'local_cursor': WebUtil.getQueryVar('cursor', true),
-                       'updateState':  updateState});
+                           'true_color':   WebUtil.getQueryVar('true_color', true),
+                           'local_cursor': WebUtil.getQueryVar('cursor', true),
+                           'shared':       WebUtil.getQueryVar('shared', true),
+                           'updateState':  updateState});
             rfb.connect(host, port, password);
             rfb.connect(host, port, password);
         };
         };
         </script>
         </script>