From b95d5c83e926aeb8a63d4532a88c4c2480e970be Mon Sep 17 00:00:00 2001 From: rbuj Date: Mon, 27 Jul 2020 01:37:54 +0200 Subject: caja-dnd: Create links by default on dnd from Web Browsers --- libcaja-private/caja-dnd.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'libcaja-private') diff --git a/libcaja-private/caja-dnd.c b/libcaja-private/caja-dnd.c index dfea8023..796753e4 100644 --- a/libcaja-private/caja-dnd.c +++ b/libcaja-private/caja-dnd.c @@ -349,20 +349,28 @@ caja_drag_items_on_desktop (const GList *selection_list) GdkDragAction caja_drag_default_drop_action_for_netscape_url (GdkDragContext *context) { - /* Mozilla defaults to copy, but unless thats the - only allowed thing (enforced by ctrl) we want to ASK */ - if (gdk_drag_context_get_suggested_action (context) == GDK_ACTION_COPY && - gdk_drag_context_get_actions (context) != GDK_ACTION_COPY) + /* Mozilla defaults to copy, however by default caja creates a link + * if available. + * + * Enforced action X: + * ((actions & X) != 0) && (suggested_action == X) + * - GDK_ACTION_LINK enforced by Alt + * - GDK_ACTION_MOVE enforced by Shift + * - GDK_ACTION_COPY enforced by Ctrl + */ + GdkDragAction suggested_action = gdk_drag_context_get_suggested_action (context); + GdkDragAction actions = gdk_drag_context_get_actions (context); + if ((actions & GDK_ACTION_LINK) == GDK_ACTION_LINK) { - return GDK_ACTION_ASK; + return GDK_ACTION_LINK; } - else if (gdk_drag_context_get_suggested_action (context) == GDK_ACTION_MOVE) + else if (suggested_action == GDK_ACTION_MOVE) { /* Don't support move */ return GDK_ACTION_COPY; } - return gdk_drag_context_get_suggested_action (context); + return suggested_action; } static gboolean -- cgit v1.2.1