From 27e77d468f041e91c717be37d48242d392e2a81a Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Thu, 28 Apr 2016 06:46:40 -0500 Subject: [PATCH] Adds tap-to-click in viewport drag mode (#600) --- include/rfb.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/rfb.js b/include/rfb.js index 5d98dbd2..e409217a 100644 --- a/include/rfb.js +++ b/include/rfb.js @@ -119,6 +119,7 @@ var RFB; this._mouse_arr = []; this._viewportDragging = false; this._viewportDragPos = {}; + this._viewportHasMoved = false; // set the default value on user-facing properties Util.set_defaults(this, defaults, { @@ -593,6 +594,13 @@ var RFB; 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._view_only) { + RFB.messages.pointerEvent(this._sock, this._display.absX(x), this._display.absY(y), bmask); + } + this._viewportHasMoved = false; } } @@ -608,6 +616,11 @@ var RFB; var deltaY = this._viewportDragPos.y - y; this._viewportDragPos = {'x': x, 'y': y}; + // if there is actually viewport move, set the HasMoved flag to true + if (deltaX != 0 || deltaY != 0) { + this._viewportHasMoved = true; + } + this._display.viewportChangePos(deltaX, deltaY); // Skip sending mouse events