[gnome-shell/gbsneto/icon-grid-dnd: 12/13] appIcon: End running drag operations on destroy



commit 7bb3de47043b21a4698aed3bbc1277bd8c30fa7d
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Sat Jun 29 01:32:40 2019 -0300

    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/602

 js/ui/appDisplay.js | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index af6a5f94a..e3a25dee7 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -1666,13 +1666,16 @@ var AppIcon = class AppIcon {
         if (isDraggable) {
             this._draggable = DND.makeDraggable(this.actor);
             this._draggable.connect('drag-begin', () => {
+                this._dragging = true;
                 this._removeMenuTimeout();
                 Main.overview.beginItemDrag(this);
             });
             this._draggable.connect('drag-cancelled', () => {
+                this._dragging = false;
                 Main.overview.cancelledItemDrag(this);
             });
             this._draggable.connect('drag-end', () => {
+                this._dragging = false;
                Main.overview.endItemDrag(this);
             });
         }
@@ -1689,6 +1692,10 @@ var AppIcon = class AppIcon {
     _onDestroy() {
         if (this._stateChangedId > 0)
             this.app.disconnect(this._stateChangedId);
+        if (this._draggable && this._dragging) {
+            Main.overview.endItemDrag(this);
+            this.draggable = null;
+        }
         this._stateChangedId = 0;
         this._removeMenuTimeout();
     }


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