diff options
author | Samuel Mannehed <samuel@cendio.se> | 2016-08-30 09:27:32 +0200 |
---|---|---|
committer | Samuel Mannehed <samuel@cendio.se> | 2016-08-30 09:42:14 +0200 |
commit | 0ccf432f12e57ecee858ec68ca23a01e41498829 (patch) | |
tree | 6c48182cf4e078191c8fd5c9e2842ec6db8c40e7 | |
parent | f4f4e8993d6daeb43b957766cd6973993232ba13 (diff) | |
download | novnc-nokeyboardviewonly.tar.gz |
View-only mode doesn't need keyboard or mousenokeyboardviewonly
Grabbing the keyboard and mouse is unnecessary in view_only mode.
In fact its unnecessary to create the objects at all. Fixes #644.
-rw-r--r-- | include/rfb.js | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/include/rfb.js b/include/rfb.js index 9935962..55313ac 100644 --- a/include/rfb.js +++ b/include/rfb.js @@ -184,13 +184,15 @@ var RFB; throw exc; } - this._keyboard = new Keyboard({target: this._focusContainer, - onKeyPress: this._handleKeyPress.bind(this)}); - - this._mouse = new Mouse({target: this._target, - onMouseButton: this._handleMouseButton.bind(this), - onMouseMove: this._handleMouseMove.bind(this), - notify: this._keyboard.sync.bind(this._keyboard)}); + if (!this._view_only) { + this._keyboard = new Keyboard({target: this._focusContainer, + onKeyPress: this._handleKeyPress.bind(this)}); + + this._mouse = new Mouse({target: this._target, + onMouseButton: this._handleMouseButton.bind(this), + onMouseMove: this._handleMouseMove.bind(this), + notify: this._keyboard.sync.bind(this._keyboard)}); + } this._sock = new Websock(); this._sock.on('message', this._handle_message.bind(this)); |