[gnome-shell/gbsneto/icon-grid-dnd: 11/13] folderView: Block DnD in folder view



commit 842328a161357a03917a7fc422048c426705ec38
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Sat Jun 29 01:27:25 2019 -0300

    folderView: Block DnD in folder view
    
    Dropping an app icon inside the folder it already is
    removes it from there. That's because none of the
    actors inside the folder actually prevent the DnD from
    happening.
    
    Block DnD from propagating up to AllView by making
    FolderView implement the Draggable interface.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/602

 js/ui/appDisplay.js | 10 ++++++++++
 1 file changed, 10 insertions(+)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 58499c03a..af6a5f94a 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -1100,6 +1100,7 @@ var FolderView = class FolderView extends BaseAppView {
         // the second time it allocates, so we apply the "Standard hack for ClutterBinLayout"
         this._grid.x_expand = true;
         this._folderIcon = folderIcon;
+        this._grid._delegate = this;
 
         this.actor = new St.ScrollView({ overlay_scrollbars: true });
         this.actor.set_policy(St.PolicyType.NEVER, St.PolicyType.AUTOMATIC);
@@ -1203,6 +1204,15 @@ var FolderView = class FolderView extends BaseAppView {
         this._offsetForEachSide = offset;
     }
 
+    handleDragOver(source, actor, x, y, time) {
+        return DND.DragMotionResult.NO_DROP;
+    }
+
+    acceptDrop(source, actor, x, y, time) {
+        // Only dropping at the folder icon is accepted
+        return true;
+    }
+
     get folderIcon() {
         return this._folderIcon;
     }


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