diff options
author | Samuel Mannehed <samuel@cendio.se> | 2020-05-10 02:05:38 +0200 |
---|---|---|
committer | Samuel Mannehed <samuel@cendio.se> | 2020-05-31 00:53:15 +0200 |
commit | 11a22dbf0c3a44963ae95ab3aba876dd8db54e6b (patch) | |
tree | e6937227d7fae19994397d1a78e127c8723268db | |
parent | 006743857bd3fc25ff475a6c942f1fcbe2d20e88 (diff) | |
download | novnc-11a22dbf0c3a44963ae95ab3aba876dd8db54e6b.tar.gz |
Stop send mouse clicks while dragging in view only
-rw-r--r-- | core/rfb.js | 2 | ||||
-rw-r--r-- | tests/test.rfb.js | 7 |
2 files changed, 9 insertions, 0 deletions
diff --git a/core/rfb.js b/core/rfb.js index e93be0f..351e4b3 100644 --- a/core/rfb.js +++ b/core/rfb.js @@ -836,6 +836,8 @@ export default class RFB extends EventTargetMixin { return; } + if (this._viewOnly) { return; } + // Otherwise we treat this as a mouse click event. // Send the button down event here, as the button up // event is sent at the end of this function. diff --git a/tests/test.rfb.js b/tests/test.rfb.js index 695e4a3..7c6128e 100644 --- a/tests/test.rfb.js +++ b/tests/test.rfb.js @@ -514,6 +514,13 @@ describe('Remote Frame Buffer Protocol Client', function () { expect(RFB.messages.pointerEvent).to.have.been.calledTwice; }); + it('should not send button messages when in view only', function () { + client._viewOnly = true; + client._handleMouseButton(13, 9, 0x001); + client._handleMouseButton(13, 9, 0x000); + expect(RFB.messages.pointerEvent).to.not.have.been.called; + }); + it('should send button message directly when drag is disabled', function () { client.dragViewport = false; client._handleMouseButton(13, 9, 0x001); |