From 8a8fa1d90613aeb81dd835e969b7d731c9bc0a88 Mon Sep 17 00:00:00 2001 From: Samuel Mannehed Date: Sun, 10 May 2020 02:05:38 +0200 Subject: [PATCH] Stop send mouse clicks while dragging in view only --- kasmweb/core/rfb.js | 2 ++ kasmweb/tests/test.rfb.js | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/kasmweb/core/rfb.js b/kasmweb/core/rfb.js index b3c7dbf..f8e0992 100644 --- a/kasmweb/core/rfb.js +++ b/kasmweb/core/rfb.js @@ -903,6 +903,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/kasmweb/tests/test.rfb.js b/kasmweb/tests/test.rfb.js index 9b511cc..b7b7e3d 100644 --- a/kasmweb/tests/test.rfb.js +++ b/kasmweb/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);