[nautilus] list-base: Don't reject view drop target



commit d62c0550c238eed69cf6dda0b542bbfc215d0c11
Author: Corey Berla <corey berla me>
Date:   Thu Jun 30 16:15:07 2022 -0700

    list-base: Don't reject view drop target
    
    If the drag_view_action is 0, gtk_drop_target_reject() is called
    thereby not allowing a drag to occur when the directory is changed
    via hover.  Don't call gtk_drop_target_reject() on the view itself.
    
    Instead, return FALSE on ::drop.

 src/nautilus-list-base.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/src/nautilus-list-base.c b/src/nautilus-list-base.c
index c6809c6a8..ef08775a3 100644
--- a/src/nautilus-list-base.c
+++ b/src/nautilus-list-base.c
@@ -764,7 +764,8 @@ on_view_drag_enter (GtkDropTarget *target,
     priv->drag_view_action = get_preferred_action (dest_file, value);
     if (priv->drag_view_action == 0)
     {
-        gtk_drop_target_reject (target);
+        /* Don't summarily reject because the view's location might change on
+         * hover, so a DND action may become available. */
         return 0;
     }
 
@@ -812,9 +813,17 @@ on_view_drop (GtkDropTarget *target,
               gpointer       user_data)
 {
     NautilusListBase *self = user_data;
+    NautilusListBasePrivate *priv = nautilus_list_base_get_instance_private (self);
     GdkDragAction actions;
     GFile *target_location;
 
+    if (priv->drag_view_action == 0)
+    {
+        /* We didn't reject earlier because the view's location may change and,
+         * as a result, a drop action might become available. */
+        return FALSE;
+    }
+
     actions = gdk_drop_get_actions (gtk_drop_target_get_current_drop (target));
     target_location = nautilus_view_get_location (NAUTILUS_VIEW (self));
 


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