summaryrefslogtreecommitdiffstats
path: root/video/out/x11_common.c
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2023-05-20 16:51:12 -0500
committerDudemanguy <random342@airmail.cc>2023-06-12 20:50:08 +0000
commit8ecf2d37ebd31afaed9f8c3ed952f08a572ddf00 (patch)
tree22702b92698b87747860f281fbf828e07fb671e3 /video/out/x11_common.c
parent2f8d9322fd8f1bcc4ec27b917f042253e2d6b62d (diff)
downloadmpv-8ecf2d37ebd31afaed9f8c3ed952f08a572ddf00.tar.bz2
mpv-8ecf2d37ebd31afaed9f8c3ed952f08a572ddf00.tar.xz
player: add drag-and-drop option
Some platforms (wayland) apparently have a lot of trouble with drag and drop. The default behavior is still the same which is basically obeying what we get from the window manager/compositor, but the --drag-and-drop option allows forcibly overriding the drag and drop behavior. i.e. you can force it to always replace the playlist or append at the end. This only implements this in X11 and Wayland but in theory windows and macos could find this option useful (both hardcode the shift key for appending). Patches welcome.
Diffstat (limited to 'video/out/x11_common.c')
-rw-r--r--video/out/x11_common.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/video/out/x11_common.c b/video/out/x11_common.c
index 0b028b9122..4a9e742cc8 100644
--- a/video/out/x11_common.c
+++ b/video/out/x11_common.c
@@ -988,9 +988,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;
+ enum mp_dnd_action action;
+ if (x11->opts->drag_and_drop >= 0) {
+ action = x11->opts->drag_and_drop;
+ } else {
+ action = x11->dnd_requested_action == XA(x11, XdndActionCopy) ?
+ DND_REPLACE : DND_APPEND;
+ }
char *mime_type = x11_dnd_mime_type(x11, x11->dnd_requested_format);
MP_VERBOSE(x11, "Dropping type: %s (%s)\n",