summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--video/out/x11_common.c8
-rw-r--r--video/out/x11_common.h1
2 files changed, 8 insertions, 1 deletions
diff --git a/video/out/x11_common.c b/video/out/x11_common.c
index a5c9dd84f5..d077957c4e 100644
--- a/video/out/x11_common.c
+++ b/video/out/x11_common.c
@@ -793,6 +793,8 @@ static void vo_x11_dnd_handle_message(struct vo *vo, XClientMessageEvent *ce)
dnd_select_format(x11, args, 3);
}
} else if (ce->message_type == XA(x11, XdndPosition)) {
+ x11->dnd_requested_action = ce->data.l[4];
+
Window src = ce->data.l[0];
XEvent xev;
@@ -836,9 +838,13 @@ static void vo_x11_dnd_handle_selection(struct vo *vo, XSelectionEvent *se)
void *prop = x11_get_property(x11, x11->window, XAs(x11, DND_PROPERTY),
x11->dnd_requested_format, 8, &nitems);
if (prop) {
+ enum mp_dnd_action action =
+ x11->dnd_requested_action == XA(x11, XdndActionCopy) ?
+ DND_REPLACE : DND_APPEND;
+
// No idea if this is guaranteed to be \0-padded, so use bstr.
success = mp_event_drop_mime_data(vo->input_ctx, "text/uri-list",
- (bstr){prop, nitems}, DND_REPLACE) > 0;
+ (bstr){prop, nitems}, action) > 0;
XFree(prop);
}
}
diff --git a/video/out/x11_common.h b/video/out/x11_common.h
index 5c99013ced..50892cf26a 100644
--- a/video/out/x11_common.h
+++ b/video/out/x11_common.h
@@ -112,6 +112,7 @@ struct vo_x11_state {
/* drag and drop */
Atom dnd_requested_format;
+ Atom dnd_requested_action;
Window dnd_src_window;
/* dragging the window */