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
This commit is contained in:
Carlos Garnacho 2018-09-10 14:24:57 +02:00 committed by Florian Müllner
parent c2961f2152
commit 7a86637f8d

View File

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