summaryrefslogtreecommitdiffstats
path: root/video/out/wayland_common.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-01-04 19:32:09 +0100
committerwm4 <wm4@nowhere>2014-01-04 19:33:40 +0100
commit7c6bb321eb0542c474e5147558fb71ecf2d44bd4 (patch)
tree82a8d90b9bbc0f33b390d95ca78d5d0a24c64405 /video/out/wayland_common.c
parent6534839154b9644a0019baf155f9bda542aa6e75 (diff)
downloadmpv-7c6bb321eb0542c474e5147558fb71ecf2d44bd4.tar.bz2
mpv-7c6bb321eb0542c474e5147558fb71ecf2d44bd4.tar.xz
video/out: remove some code duplication between X11 and wayland
Both X11 and Wayland support the same format for drag & drop operations (text/uri-list), and the code for that was copied from x11_common.c to wayland_common.c. Factor it out.
Diffstat (limited to 'video/out/wayland_common.c')
-rw-r--r--video/out/wayland_common.c27
1 files changed, 2 insertions, 25 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index 7f48563204..b6bfee8733 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -734,30 +734,6 @@ static void shedule_resize(struct vo_wayland_state *wl,
wl->vo->dheight = height;
}
-// stolen from x11 code
-// The data is in the form of the mimetype text/uri-list.
-static bool dnd_handle_drop_data(struct vo *vo, bstr data)
-{
- void *tmp = talloc_new(NULL);
- int num_files = 0;
- char **files = NULL;
-
- while (data.len) {
- bstr line = bstr_getline(data, &data);
- line = bstr_strip_linebreaks(line);
- if (bstr_startswith0(line, "#"))
- continue;
-
- char *s = bstrto0(tmp, line);
- MP_TARRAY_APPEND(tmp, files, num_files, s);
-
- }
- mp_event_drop_files(vo->input_ctx, num_files, files);
-
- talloc_free(tmp);
- return num_files > 0;
-}
-
static bool create_display (struct vo_wayland_state *wl)
{
wl->display.display = wl_display_connect(NULL);
@@ -1038,7 +1014,8 @@ static int vo_wayland_check_events (struct vo *vo)
if (has_read < to_read) {
buffer[str_len] = 0;
struct bstr file_list = bstr0(buffer);
- dnd_handle_drop_data(wl->vo, file_list);
+ mp_event_drop_mime_data(vo->input_ctx, "text/uri-list",
+ file_list);
break;
}
}