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



commit 9f9672bd30079be95a8a46ed46ed0b1c381ab5a2
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/603

 js/ui/appDisplay.js | 10 ++++++++++
 1 file changed, 10 insertions(+)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index a75869fd2..abdc5c01a 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -1084,6 +1084,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);
@@ -1187,6 +1188,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]