]> git.proxmox.com Git - mirror_novnc.git/commitdiff
Don't send pointer event on end of drag
authorPierre Ossman <ossman@cendio.se>
Thu, 30 Nov 2017 15:11:23 +0000 (16:11 +0100)
committerPierre Ossman <ossman@cendio.se>
Thu, 30 Nov 2017 15:15:42 +0000 (16:15 +0100)
We should only send an event to the server if we didn't actually
end up dragging the viewport.

core/rfb.js

index 41157452a588fad5e47614c20ce4016005979261..a5bd843e7d4f0c6dd77a7f2894c3bc2ec9cc406d 100644 (file)
@@ -634,18 +634,26 @@ RFB.prototype = {
             if (down && !this._viewportDragging) {
                 this._viewportDragging = true;
                 this._viewportDragPos = {'x': x, 'y': y};
             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;
 
 
                 // 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);
             }
         }
 
             }
         }