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



commit f10f60be3b17f6ff270be11b00f3f0e7fc1435c3
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 a23b36932..fd29338c0 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -1099,6 +1099,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);
@@ -1202,6 +1203,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]