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.
This commit is contained in:
Pierre Ossman 2017-11-30 16:11:23 +01:00
parent bb25d3d6c5
commit 898cd32c07
1 changed files with 13 additions and 5 deletions

View File

@ -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);
}
}