Browse Source

Fix focus/clipboard related to mouse/keyboard refactor.

Joel Martin 14 năm trước cách đây
mục cha
commit
d1bd5ec7d4
3 tập tin đã thay đổi với 13 bổ sung7 xóa
  1. 0 3
      include/canvas.js
  2. 7 0
      include/rfb.js
  3. 6 4
      include/ui.js

+ 0 - 3
include/canvas.js

@@ -37,7 +37,6 @@ cdef('cursor_uri',     'raw', null, 'Can we render cursor using data URI');
 cdef('target',         'dom',  null, 'Canvas element for VNC viewport');
 cdef('focusContainer', 'dom',  document, 'DOM element that traps keyboard input');
 cdef('true_color',     'bool', true, 'Request true color pixel data');
-cdef('focused',        'bool', true, 'Capture and send key strokes');
 cdef('colourMap',      'raw',  [], 'Colour map array (not true color)');
 cdef('scale',          'float', 1, 'VNC viewport scale factor');
 
@@ -204,8 +203,6 @@ function constructor() {
         conf.cursor_uri = false;
     }
 
-    conf.focused = true;
-
     Util.Debug("<< Canvas.init");
     return that ;
 }

+ 7 - 0
include/rfb.js

@@ -165,6 +165,13 @@ that.set_local_cursor = function(cursor) {
 that.get_canvas = function() {
     return canvas;
 };
+that.get_keyboard = function() {
+    return keyboard;
+};
+that.get_mouse = function() {
+    return mouse;
+};
+
 
 
 

+ 6 - 4
include/ui.js

@@ -145,8 +145,8 @@ load: function(target) {
 
     // Unfocus clipboard when over the VNC area
     $D('VNC_screen').onmousemove = function () {
-            var canvas = UI.rfb.get_canvas();
-            if ((! canvas) || (! canvas.get_focused())) {
+            var keyboard = UI.rfb.get_keyboard();
+            if ((! keyboard) || (! keyboard.get_focused())) {
                 $D('VNC_clipboard_text').blur();
             }
         };
@@ -399,11 +399,13 @@ disconnect: function() {
 },
 
 canvasBlur: function() {
-    UI.rfb.get_canvas().set_focused(false);
+    UI.rfb.get_keyboard().set_focused(false);
+    UI.rfb.get_mouse().set_focused(false);
 },
 
 canvasFocus: function() {
-    UI.rfb.get_canvas().set_focused(true);
+    UI.rfb.get_keyboard().set_focused(true);
+    UI.rfb.get_mouse().set_focused(true);
 },
 
 clipClear: function() {