]> git.proxmox.com Git - mirror_novnc.git/commitdiff
Stop send mouse clicks while dragging in view only
authorSamuel Mannehed <samuel@cendio.se>
Sun, 10 May 2020 00:05:38 +0000 (02:05 +0200)
committerSamuel Mannehed <samuel@cendio.se>
Sat, 30 May 2020 22:53:15 +0000 (00:53 +0200)
core/rfb.js
tests/test.rfb.js

index e93be0fddcb930d7ec78c0284b56741999d0675f..351e4b3c36fdd4f2c5e41babdf19cdb50864b7c9 100644 (file)
@@ -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.
index 695e4a3331bb1370e358b347eb3e37b1f9a7fa62..7c6128e6c3fe718caf0dc03e0f59c173e014da78 100644 (file)
@@ -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);