[gnome-shell/wip/carlosg/dnd-fixes: 1/2] dnd: Make startDrag() fail if there is a current grab



commit 252ce83375362fc610ffca43d27033abc38ce346
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Mar 12 01:53:16 2019 +0100

    dnd: Make startDrag() fail if there is a current grab
    
    This call just went through stomping over previous drag operations if any,
    _maybeStartDrag() accounted for this, but other callers (well, WindowClone
    in workspace.js) don't. This must bail out early even if a drag operation is
    requested, luckily all callers account for it already.
    
    This broke shell state by preserving connected captured-event handlers if
    one tried to drag multiple windows simultaneously through multitouch. We
    of course don't support that, now more elegantly.

 js/ui/dnd.js | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/dnd.js b/js/ui/dnd.js
index 614ea621d..f92339dae 100644
--- a/js/ui/dnd.js
+++ b/js/ui/dnd.js
@@ -306,6 +306,9 @@ var _Draggable = class _Draggable {
      * for the draggable.
      */
     startDrag(stageX, stageY, time, sequence, device) {
+        if (currentDraggable)
+            return;
+
         if (device == undefined) {
             let event = Clutter.get_current_event();
 
@@ -448,9 +451,8 @@ var _Draggable = class _Draggable {
 
         // See if the user has moved the mouse enough to trigger a drag
         let threshold = St.Settings.get().drag_threshold;
-        if (!currentDraggable &&
-            (Math.abs(stageX - this._dragStartX) > threshold ||
-             Math.abs(stageY - this._dragStartY) > threshold)) {
+        if (Math.abs(stageX - this._dragStartX) > threshold ||
+            Math.abs(stageY - this._dragStartY) > threshold) {
             this.startDrag(stageX, stageY, event.get_time(), this._touchSequence, event.get_device());
             this._updateDragPosition(event);
         }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]