From 898cd32c0717d491e116c3cebfac6e656f703d41 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Thu, 30 Nov 2017 16:11:23 +0100 Subject: [PATCH] Don't send pointer event on end of drag We should only send an event to the server if we didn't actually end up dragging the viewport. --- core/rfb.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/core/rfb.js b/core/rfb.js index 41157452..a5bd843e 100644 --- a/core/rfb.js +++ b/core/rfb.js @@ -634,18 +634,26 @@ RFB.prototype = { if (down && !this._viewportDragging) { this._viewportDragging = true; this._viewportDragPos = {'x': x, 'y': y}; + this._viewportHasMoved = false; // Skip sending mouse events return; } else { this._viewportDragging = false; - // If the viewport didn't actually move, then treat as a mouse click event - // Send the button down event here, as the button up event is sent at the end of this function - if (!this._viewportHasMoved && !this._viewOnly) { - RFB.messages.pointerEvent(this._sock, this._display.absX(x), this._display.absY(y), bmask); + // If we actually performed a drag then we are done + // here and should not send any mouse events + if (this._viewportHasMoved) { + return; } - this._viewportHasMoved = false; + + // 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. + RFB.messages.pointerEvent(this._sock, + this._display.absX(x), + this._display.absY(y), + bmask); } }