summaryrefslogtreecommitdiffstats
path: root/input
diff options
context:
space:
mode:
Diffstat (limited to 'input')
-rw-r--r--input/event.c12
-rw-r--r--input/event.h10
2 files changed, 15 insertions, 7 deletions
diff --git a/input/event.c b/input/event.c
index add77f0b0c..d47f17ddaf 100644
--- a/input/event.c
+++ b/input/event.c
@@ -20,7 +20,8 @@
#include "common/msg.h"
#include "sub/find_subfiles.h"
-void mp_event_drop_files(struct input_ctx *ictx, int num_files, char **files)
+void mp_event_drop_files(struct input_ctx *ictx, int num_files, char **files,
+ enum mp_dnd_action action)
{
bool all_sub = true;
for (int i = 0; i < num_files; i++)
@@ -42,8 +43,9 @@ void mp_event_drop_files(struct input_ctx *ictx, int num_files, char **files)
"osd-auto",
"loadfile",
files[i],
- /* Start playing the dropped files right away */
- (i == 0) ? "replace" : "append",
+ /* Either start playing the dropped files right away
+ or add them to the end of the current playlist */
+ (i == 0 && action == DND_REPLACE) ? "replace" : "append-play",
NULL
};
mp_input_run_cmd(ictx, cmd);
@@ -52,7 +54,7 @@ void mp_event_drop_files(struct input_ctx *ictx, int num_files, char **files)
}
int mp_event_drop_mime_data(struct input_ctx *ictx, const char *mime_type,
- bstr data)
+ bstr data, enum mp_dnd_action action)
{
// X11 and Wayland file list format.
if (strcmp(mime_type, "text/uri-list") == 0) {
@@ -67,7 +69,7 @@ int mp_event_drop_mime_data(struct input_ctx *ictx, const char *mime_type,
char *s = bstrto0(tmp, line);
MP_TARRAY_APPEND(tmp, files, num_files, s);
}
- mp_event_drop_files(ictx, num_files, files);
+ mp_event_drop_files(ictx, num_files, files, action);
talloc_free(tmp);
return num_files > 0;
} else {
diff --git a/input/event.h b/input/event.h
index a1cb542f8f..e2ce36b329 100644
--- a/input/event.h
+++ b/input/event.h
@@ -19,10 +19,16 @@
struct input_ctx;
+enum mp_dnd_action {
+ DND_REPLACE,
+ DND_APPEND,
+};
+
// Enqueue files for playback after drag and drop
-void mp_event_drop_files(struct input_ctx *ictx, int num_files, char **files);
+void mp_event_drop_files(struct input_ctx *ictx, int num_files, char **files,
+ enum mp_dnd_action append);
// Drop data in a specific format (identified by the mimetype).
// Returns <0 on error, ==0 if data was ok but empty, >0 on success.
int mp_event_drop_mime_data(struct input_ctx *ictx, const char *mime_type,
- bstr data);
+ bstr data, enum mp_dnd_action append);