summaryrefslogtreecommitdiffstats
path: root/video/out/wayland_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/wayland_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/wayland_common.c')
-rw-r--r--video/out/wayland_common.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index 48f30c9c6f..cfe641fe08 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -535,8 +535,12 @@ static void data_offer_action(void *data, struct wl_data_offer *wl_data_offer, u
{
struct vo_wayland_state *wl = data;
if (dnd_action) {
- wl->dnd_action = dnd_action & WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY ?
- DND_REPLACE : DND_APPEND;
+ if (wl->vo_opts->drag_and_drop >= 0) {
+ wl->dnd_action = wl->vo_opts->drag_and_drop;
+ } else {
+ wl->dnd_action = dnd_action & WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY ?
+ DND_REPLACE : DND_APPEND;
+ }
MP_VERBOSE(wl, "DND action is %s\n",
wl->dnd_action == DND_REPLACE ? "DND_REPLACE" : "DND_APPEND");
}