From afb65585741eec5a6fd1a08b6a2b56087a31f66e Mon Sep 17 00:00:00 2001 From: Theo Linkspfeifer Date: Sun, 12 May 2019 00:44:44 +0200 Subject: [PATCH 2/2] 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 d9147aa7..4299862d 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 1b31b81d..5142712b 100644 --- a/thunar/thunar-standard-view.c +++ b/thunar/thunar-standard-view.c @@ -3103,6 +3103,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); @@ -3112,10 +3114,16 @@ thunar_standard_view_motion_notify_event (GtkWidget *view, /* cancel the drag timer, as we won't popup the menu anymore */ g_source_remove (standard_view->priv->drag_timer_id); - /* 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; } -- 2.20.1