summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorStefano Pigozzi <stefano.pigozzi@gmail.com>2014-01-04 16:59:22 +0100
committerStefano Pigozzi <stefano.pigozzi@gmail.com>2014-01-04 17:28:55 +0100
commit082c5c19a1efe3c450f1ad1b0411d335be88e60e (patch)
tree37f3eb64aee2285295c0c87bfae0e80a79f7d0e8 /video
parentbb3ea1580ebb9715ad5cc8829fcbe556c87db66e (diff)
downloadmpv-082c5c19a1efe3c450f1ad1b0411d335be88e60e.tar.bz2
mpv-082c5c19a1efe3c450f1ad1b0411d335be88e60e.tar.xz
input: move files drag and drop to a new event.c file
event.c will be used to feed the input queue with 'global' events that don't mesh well with the usual check_events path in mpv.
Diffstat (limited to 'video')
-rw-r--r--video/out/vo.c41
-rw-r--r--video/out/wayland_common.c3
-rw-r--r--video/out/x11_common.c3
3 files changed, 4 insertions, 43 deletions
diff --git a/video/out/vo.c b/video/out/vo.c
index 68fb7d0ee7..99efc9eec9 100644
--- a/video/out/vo.c
+++ b/video/out/vo.c
@@ -43,7 +43,6 @@
#include "video/mp_image.h"
#include "video/vfcap.h"
#include "sub/osd.h"
-#include "sub/find_subfiles.h"
//
// Externally visible list of all vo drivers
@@ -620,43 +619,3 @@ void vo_mouse_movement(struct vo *vo, int posx, int posy)
vo_control(vo, VOCTRL_WINDOW_TO_OSD_COORDS, p);
mp_input_set_mouse_pos(vo->input_ctx, p[0], p[1]);
}
-
-static void run_cmd(struct vo *vo, const char **cmd)
-{
- mp_cmd_t *cmdt = mp_input_parse_cmd_strv(vo->log,
- MP_ON_OSD_AUTO,
- cmd, "<window>");
- mp_input_queue_cmd(vo->input_ctx, cmdt);
-}
-
-// Handle drag & drop event of a list of files on the VO window.
-void vo_drop_files(struct vo *vo, int num_files, char **files)
-{
- bool all_sub = true;
- for (int i = 0; i < num_files; i++)
- all_sub &= mp_might_be_subtitle_file(files[i]);
-
- if (all_sub) {
- for (int i = 0; i < num_files; i++) {
- const char *cmd[] = {
- "sub_add",
- files[i],
- NULL
- };
- run_cmd(vo, cmd);
- }
- } else {
- for (int i = 0; i < num_files; i++) {
- const char *cmd[] = {
- "loadfile",
- files[i],
- /* Start playing the dropped files right away */
- (i == 0) ? "replace" : "append",
- NULL
- };
-
- MP_VERBOSE(vo, "received dropped file: %s\n", files[i]);
- run_cmd(vo, cmd);
- }
- }
-}
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index a5b73c1c6f..7f48563204 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -44,6 +44,7 @@
#include "osdep/timer.h"
#include "input/input.h"
+#include "input/event.h"
#include "input/keycodes.h"
#define MOD_SHIFT_MASK 0x01
@@ -751,7 +752,7 @@ static bool dnd_handle_drop_data(struct vo *vo, bstr data)
MP_TARRAY_APPEND(tmp, files, num_files, s);
}
- vo_drop_files(vo, num_files, files);
+ mp_event_drop_files(vo->input_ctx, num_files, files);
talloc_free(tmp);
return num_files > 0;
diff --git a/video/out/x11_common.c b/video/out/x11_common.c
index 2e8b0917ac..a48c3f6e0e 100644
--- a/video/out/x11_common.c
+++ b/video/out/x11_common.c
@@ -27,6 +27,7 @@
#include "options/options.h"
#include "common/msg.h"
#include "input/input.h"
+#include "input/event.h"
#include "libavutil/common.h"
#include "x11_common.h"
#include "talloc.h"
@@ -749,7 +750,7 @@ static bool dnd_handle_drop_data(struct vo *vo, bstr data)
char *s = bstrto0(tmp, line);
MP_TARRAY_APPEND(tmp, files, num_files, s);
}
- vo_drop_files(vo, num_files, files);
+ mp_event_drop_files(vo->input_ctx, num_files, files);
talloc_free(tmp);
return num_files > 0;
}