[Xfce4-commits] [xfce/thunar] 02/02: Restore right-click drag and drop functionality (Bug #14583)

noreply at xfce.org noreply at xfce.org
Fri May 17 23:14:24 CEST 2019


This is an automated email from the git hooks/post-receive script.

a   l   e   x       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/thunar.

commit 6d5cc5c763c84cab9f3e2cfa558ecc9c788d79e6
Author: Theo Linkspfeifer <lastonestanding at tutanota.com>
Date:   Tue May 14 22:52:20 2019 +0200

    Restore right-click drag and drop functionality (Bug #14583)
---
 thunar/thunar-file.c          | 11 +++++++++--
 thunar/thunar-standard-view.c | 16 ++++++++++++----
 2 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c
index d9147aa..4299862 100644
--- a/thunar/thunar-file.c
+++ b/thunar/thunar-file.c
@@ -2031,11 +2031,18 @@ thunar_file_accepts_drop (ThunarFile     *file,
   /* default to whatever GTK+ thinks for the suggested action */
   suggested_action = gdk_drag_context_get_suggested_action (context);
 
+  /* get the possible actions */
+  actions = gdk_drag_context_get_actions (context);
+
+  /* when the option to ask the user is set, make it the preferred action */
+  if (G_UNLIKELY ((actions & GDK_ACTION_ASK) != 0))
+    suggested_action = GDK_ACTION_ASK;
+
   /* check if we have a writable directory here or an executable file */
   if (thunar_file_is_directory (file) && thunar_file_is_writable (file))
     {
       /* determine the possible actions */
-      actions = gdk_drag_context_get_actions (context) & (GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK | GDK_ACTION_ASK);
+      actions &= (GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK | GDK_ACTION_ASK);
 
       /* cannot create symbolic links in the trash or copy to the trash */
       if (thunar_file_is_trashed (file))
@@ -2113,7 +2120,7 @@ thunar_file_accepts_drop (ThunarFile     *file,
   else if (thunar_file_is_executable (file))
     {
       /* determine the possible actions */
-      actions = gdk_drag_context_get_actions (context) & (GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK | GDK_ACTION_PRIVATE);
+      actions &= (GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK | GDK_ACTION_PRIVATE);
     }
   else
     return 0;
diff --git a/thunar/thunar-standard-view.c b/thunar/thunar-standard-view.c
index 9b3d8b3..0853d6c 100644
--- a/thunar/thunar-standard-view.c
+++ b/thunar/thunar-standard-view.c
@@ -3106,6 +3106,8 @@ thunar_standard_view_motion_notify_event (GtkWidget          *view,
                                           GdkEventMotion     *event,
                                           ThunarStandardView *standard_view)
 {
+  GtkTargetList  *target_list;
+
   _thunar_return_val_if_fail (THUNAR_IS_STANDARD_VIEW (standard_view), FALSE);
   _thunar_return_val_if_fail (standard_view->priv->drag_timer_id != 0, FALSE);
 
@@ -3117,10 +3119,16 @@ thunar_standard_view_motion_notify_event (GtkWidget          *view,
       gdk_event_free (standard_view->priv->drag_timer_event);
       standard_view->priv->drag_timer_event = NULL;
 
-      /* FIXME
-       * - according to doc, the GdkWindow associated to the widget needs to enable the GDK_POINTER_MOTION_MASK mask to use this event.
-       * We dont do that. So possibly this is dead code, which can be removed ?
-      */
+      /* allocate the drag context */
+      target_list = gtk_target_list_new (drag_targets, G_N_ELEMENTS (drag_targets));
+      gtk_drag_begin_with_coordinates (view, target_list,
+                                       GDK_ACTION_COPY |
+                                       GDK_ACTION_MOVE |
+                                       GDK_ACTION_LINK |
+                                       GDK_ACTION_ASK,
+                                       3, (GdkEvent *) event, -1, -1);
+      gtk_target_list_unref (target_list);
+
       return TRUE;
     }
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list