[gnome-shell/gbsneto/custom-icon-positions: 20/27] appDisplay: Restore dragged item's position on drag cancel



commit 2a99eedc1129caafec6c72d325173e1471d26c53
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Jun 23 10:33:22 2020 -0300

    appDisplay: Restore dragged item's position on drag cancel
    
    https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1284

 js/ui/appDisplay.js | 11 +++++++++++
 1 file changed, 11 insertions(+)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 8e13a14b71..b9dd484764 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -642,6 +642,7 @@ class AppDisplay extends BaseAppView {
 
         Main.overview.connect('item-drag-begin', this._onDragBegin.bind(this));
         Main.overview.connect('item-drag-end', this._onDragEnd.bind(this));
+        Main.overview.connect('item-drag-cancelled', this._onDragCancelled.bind(this));
 
         this.connect('destroy', this._onDestroy.bind(this));
 
@@ -1063,6 +1064,16 @@ class AppDisplay extends BaseAppView {
         this._removeNudge();
     }
 
+    _onDragCancelled(_overview, source) {
+        const view = _getViewFromIcon(source);
+
+        if (view instanceof FolderView)
+            return;
+
+        const [originalPage, originalPosition] = this._getItemPosition(source);
+        this.moveItem(source, originalPage, originalPosition);
+    }
+
     _canAccept(source) {
         return source instanceof BaseAppIcon;
     }


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