[gnome-shell/gbsneto/icon-grid-dnd: 6/9] appIcon: Use a real BaseIcon as the drag actor



commit 6fb43e16be95d776812defc3711ca207cd770c52
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Jul 3 13:29:20 2019 -0300

    appIcon: Use a real BaseIcon as the drag actor
    
    Moving an app icon to other positions is semantically different
    to dragging an actor to the dash; the act of moving should itself
    be semantic, in that we should feel like we are moving the actual
    icon.
    
    Currently, AppIcon gives the DnD code a simplified version of itself,
    with just its icon, instead of a complete copy with the label.
    
    Make AppIcon create a new IconGrid.BaseIcon and use it as the drag
    actor.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/603

 js/ui/appDisplay.js | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 4d4dd31d0..ec1c62d9d 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -1825,15 +1825,18 @@ var AppIcon = class AppIcon {
             this._draggable = DND.makeDraggable(this.actor);
             this._draggable.connect('drag-begin', () => {
                 this._dragging = true;
+                this.actor.opacity = 0;
                 this._removeMenuTimeout();
                 Main.overview.beginItemDrag(this);
             });
             this._draggable.connect('drag-cancelled', () => {
                 this._dragging = false;
+                this.actor.opacity = 255;
                 Main.overview.cancelledItemDrag(this);
             });
             this._draggable.connect('drag-end', () => {
                 this._dragging = false;
+                this.actor.opacity = 255;
                 Main.overview.endItemDrag(this);
             });
         }
@@ -2044,7 +2047,12 @@ var AppIcon = class AppIcon {
     }
 
     getDragActor() {
-        return this.app.create_icon_texture(Main.overview.dashIconSize);
+        let iconParams = { createIcon: this._createIcon.bind(this),
+                           showLabel: (this.icon.label != null),
+                           setSizeManually: false };
+
+        let icon = new IconGrid.BaseIcon(this.name, iconParams);
+        return icon;
     }
 
     // Returns the original actor that should align with the actor


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