appIcon: End running drag operations on destroy

AppIcon makes itself draggable, and handles the various DnD
routines such as 'drag-begin' and 'drag-end' by making the
Overview emit the appropriate signals.

However, when destroyed, the AppIcon does not try to finish
any drag operations that started. That causes the event
blocker in AllView not to be updated correctly when dragging
icons to outside folders.

Make AppIcon emit 'item-drag-end' when a drag operation
started and it's destroyed.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/643
This commit is contained in:
Georges Basile Stavracas Neto 2019-06-29 01:32:40 -03:00
parent a57c4c580e
commit 3db1058c2c

View File

@ -1532,13 +1532,16 @@ var AppIcon = class AppIcon {
if (isDraggable) { if (isDraggable) {
this._draggable = DND.makeDraggable(this.actor); this._draggable = DND.makeDraggable(this.actor);
this._draggable.connect('drag-begin', () => { this._draggable.connect('drag-begin', () => {
this._dragging = true;
this._removeMenuTimeout(); this._removeMenuTimeout();
Main.overview.beginItemDrag(this); Main.overview.beginItemDrag(this);
}); });
this._draggable.connect('drag-cancelled', () => { this._draggable.connect('drag-cancelled', () => {
this._dragging = false;
Main.overview.cancelledItemDrag(this); Main.overview.cancelledItemDrag(this);
}); });
this._draggable.connect('drag-end', () => { this._draggable.connect('drag-end', () => {
this._dragging = false;
Main.overview.endItemDrag(this); Main.overview.endItemDrag(this);
}); });
} }
@ -1555,6 +1558,10 @@ var AppIcon = class AppIcon {
_onDestroy() { _onDestroy() {
if (this._stateChangedId > 0) if (this._stateChangedId > 0)
this.app.disconnect(this._stateChangedId); this.app.disconnect(this._stateChangedId);
if (this._draggable && this._dragging) {
Main.overview.endItemDrag(this);
this.draggable = null;
}
this._stateChangedId = 0; this._stateChangedId = 0;
this._removeMenuTimeout(); this._removeMenuTimeout();
} }