diff options
author | rbuj <[email protected]> | 2020-07-27 01:37:54 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2022-07-21 19:33:49 +0200 |
commit | 8a8185638aac9cb3425d24032266fc68041033f9 (patch) | |
tree | 20a1af37ff6c69b7b9ed92a360edcfe50555f722 /libcaja-private | |
parent | f8ba5e8d2b3850ea7e21954d1bb8f09eb7af77d6 (diff) | |
download | caja-8a8185638aac9cb3425d24032266fc68041033f9.tar.bz2 caja-8a8185638aac9cb3425d24032266fc68041033f9.tar.xz |
caja-dnd: Create links by default on dnd from Web Browsers
Diffstat (limited to 'libcaja-private')
-rw-r--r-- | libcaja-private/caja-dnd.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/libcaja-private/caja-dnd.c b/libcaja-private/caja-dnd.c index 29603942..7a16a8f5 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 |