Jelajahi Sumber

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 15 tahun lalu
induk
melakukan
f1a9971c82
4 mengubah file dengan 13 tambahan dan 8 penghapusan
  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 firefox 4
-
 - Fix cursor URI detection in Arora:
     - allows data URI, but doesn't actually work
 
@@ -22,7 +20,6 @@ Medium Term:
     - Configuration menu:
         - Tunable: speed vs. bandwidth selection
         - Tunable: CPU use versus latency.
-        - shared mode
         - Scaling
 
     - Keyboard menu:

+ 7 - 0
include/default_controls.js

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

+ 2 - 2
include/rfb.js

@@ -39,7 +39,6 @@ var that           = {},         // Public API interface
     rfb_version    = 0,
     rfb_max_version= 3.8,
     rfb_auth_scheme= '',
-    rfb_shared     = 1,
 
 
     // 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('true_color',     'bool', true,  'Request true color pixel data');
 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('disconnectTimeout', 'int', 3,    'Time (s) to wait for disconnection');
@@ -826,7 +826,7 @@ init_msg = function() {
             case 2:  // too-many
                 return fail("Too many auth attempts");
         }
-        send_array([rfb_shared]); // ClientInitialisation
+        send_array([conf.shared ? 1 : 0]); // ClientInitialisation
         break;
 
     case 'ServerInitialisation' :

+ 4 - 3
vnc_auto.html

@@ -101,9 +101,10 @@
             }
 
             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);
         };
         </script>