summaryrefslogtreecommitdiff
path: root/libcaja-private/caja-dnd.c
diff options
context:
space:
mode:
authorrbuj <[email protected]>2020-07-27 01:37:54 +0200
committerraveit65 <[email protected]>2020-07-27 18:09:54 +0200
commitb95d5c83e926aeb8a63d4532a88c4c2480e970be (patch)
tree2940ea74acf7720dd4a058dd184cbc296ff7b16c /libcaja-private/caja-dnd.c
parent969fe79d5b420b89548da7a81fb46a42044b8665 (diff)
downloadcaja-b95d5c83e926aeb8a63d4532a88c4c2480e970be.tar.bz2
caja-b95d5c83e926aeb8a63d4532a88c4c2480e970be.tar.xz
caja-dnd: Create links by default on dnd from Web Browsers
Diffstat (limited to 'libcaja-private/caja-dnd.c')
-rw-r--r--libcaja-private/caja-dnd.c22
1 files changed, 15 insertions, 7 deletions
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