[gnome-shell/wip/carlosg/tablet-dnd-on-chrome: 6/7] dnd: Avoid breaking drag state on cancellation



commit 7a86637f8d6e3a04d4aa2e293963b62b7da6d59f
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Sep 10 14:24:57 2018 +0200

    dnd: Avoid breaking drag state on cancellation
    
    In the case where the draggable has an actor of its own, state could be
    left broken when dragging on a place that would not accept the DnD op.
    After button release, drag state is set to "cancelled" and the animation
    begins. After the animation is finished, the drag actor would be destroyed
    before disconnecting from its destroy handler.
    
    Within the destroy handler, the grab would be undone but drag state would
    be left on "cancelled" state for subsequent operations. This results in
    DnD oddities and stuck grabs.
    
    In order to fix this, double check in the actor destroy handler that we
    are actually dragging before setting the "cancelled" state.
    
    Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/540

 js/ui/dnd.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/dnd.js b/js/ui/dnd.js
index 0562c7cbd..23af7ba95 100644
--- a/js/ui/dnd.js
+++ b/js/ui/dnd.js
@@ -374,7 +374,8 @@ var _Draggable = class _Draggable {
             this._finishAnimation();
 
             this._dragActor = null;
-            this._dragState = DragState.CANCELLED;
+            if (this._dragState == DragState.DRAGGING)
+                this._dragState = DragState.CANCELLED;
         });
         this._dragOrigOpacity = this._dragActor.opacity;
         if (this._dragActorOpacity != undefined)


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