diff options
author | David Vaughan <david@davidv.xyz> | 2024-02-03 19:41:43 -0800 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2024-02-26 02:03:21 +0000 |
commit | a8a314b829498c55aed393d4bc7f4f7bf9e92362 (patch) | |
tree | c220248353f4a8c2f0feb74707bb4eb317653c14 /input/event.c | |
parent | 432256e5d2ccee8806023f03aea076f46d9cc9ea (diff) | |
download | mpv-a8a314b829498c55aed393d4bc7f4f7bf9e92362.tar.bz2 mpv-a8a314b829498c55aed393d4bc7f4f7bf9e92362.tar.xz |
input: add insert-next support for drag-and-drop
This commit adds a DND_INSERT_NEXT action option for drag-and-drop,
allows for selecting it through the --drag-and-drop=insert-next option,
and adds the necessary plumbing to make that happen when something is
dragged onto the player.
Diffstat (limited to 'input/event.c')
-rw-r--r-- | input/event.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/input/event.c b/input/event.c index 266e0294e2..6c1e00409a 100644 --- a/input/event.c +++ b/input/event.c @@ -37,6 +37,21 @@ void mp_event_drop_files(struct input_ctx *ictx, int num_files, char **files, }; mp_input_run_cmd(ictx, cmd); } + } else if (action == DND_INSERT_NEXT) { + /* To insert the entries in the correct order, we iterate over them + backwards */ + for (int i = num_files - 1; i >= 0; i--) { + const char *cmd[] = { + "osd-auto", + "loadfile", + files[i], + /* Since we're inserting in reverse, wait til the final item + is added to start playing */ + (i > 0) ? "insert-next" : "insert-next-play", + NULL + }; + mp_input_run_cmd(ictx, cmd); + } } else { for (int i = 0; i < num_files; i++) { const char *cmd[] = { |