summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorRostislav Pehlivanov <atomnuker@gmail.com>2016-07-24 00:40:26 +0100
committerwm4 <wm4@nowhere>2016-07-30 00:02:39 +0200
commitf3f4e048d8c08d4d578c85dbb32cc80314814d6f (patch)
treecd6280f407d43cba89e2c3994f053c34558b1a7f /video
parent46b60a3e72a0343611a204876522e36e7869b998 (diff)
downloadmpv-f3f4e048d8c08d4d578c85dbb32cc80314814d6f.tar.bz2
mpv-f3f4e048d8c08d4d578c85dbb32cc80314814d6f.tar.xz
wayland_common: remove untested/unusable wayland dnd code
Not worth keeping 200 lines of untestable as of today code which might be broken, if it hasn't been already.
Diffstat (limited to 'video')
-rw-r--r--video/out/wayland_common.c184
-rw-r--r--video/out/wayland_common.h5
2 files changed, 1 insertions, 188 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index 839dd69251..84bef55b9c 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -522,99 +522,6 @@ static const struct wl_seat_listener seat_listener = {
seat_handle_name,
};
-static void data_offer_handle_offer(void *data,
- struct wl_data_offer *offer,
- const char *mime_type)
-{
- struct vo_wayland_state *wl = data;
- if (strcmp(mime_type, "text/uri-list") != 0)
- MP_VERBOSE(wl, "unsupported mime type for drag and drop: %s\n", mime_type);
-}
-
-static const struct wl_data_offer_listener data_offer_listener = {
- data_offer_handle_offer,
-};
-
-static void data_device_handle_data_offer(void *data,
- struct wl_data_device *wl_data_device,
- struct wl_data_offer *id)
-{
- struct vo_wayland_state *wl = data;
- if (wl->input.offer) {
- MP_DBG(wl, "There is already a dnd entry point.\n");
- wl_data_offer_destroy(wl->input.offer);
- }
-
- wl->input.offer = id;
- wl_data_offer_add_listener(id, &data_offer_listener, wl);
-}
-
-static void data_device_handle_enter(void *data,
- struct wl_data_device *wl_data_device,
- uint32_t serial,
- struct wl_surface *surface,
- wl_fixed_t x,
- wl_fixed_t y,
- struct wl_data_offer *id)
-{
- struct vo_wayland_state *wl = data;
- if (wl->input.offer != id)
- MP_FATAL(wl, "Fatal dnd error (Please report this issue)\n");
-
- wl_data_offer_accept(id, serial, "text/uri-list");
-}
-
-static void data_device_handle_leave(void *data,
- struct wl_data_device *wl_data_device)
-{
- struct vo_wayland_state *wl = data;
- if (wl->input.offer) {
- wl_data_offer_destroy(wl->input.offer);
- wl->input.offer = NULL;
- }
- // dnd fd is closed on POLLHUP
-}
-
-static void data_device_handle_motion(void *data,
- struct wl_data_device *wl_data_device,
- uint32_t time,
- wl_fixed_t x,
- wl_fixed_t y)
-{
-}
-
-static void data_device_handle_drop(void *data,
- struct wl_data_device *wl_data_device)
-{
- struct vo_wayland_state *wl = data;
-
- int pipefd[2];
-
- if (pipe(pipefd) == -1) {
- MP_FATAL(wl, "can't create pipe for dnd communication\n");
- return;
- }
-
- wl->input.dnd_fd = pipefd[0];
- wl_data_offer_receive(wl->input.offer, "text/uri-list", pipefd[1]);
- close(pipefd[1]);
-}
-
-static void data_device_handle_selection(void *data,
- struct wl_data_device *wl_data_device,
- struct wl_data_offer *id)
-{
-}
-
-static const struct wl_data_device_listener data_device_listener = {
- data_device_handle_data_offer,
- data_device_handle_enter,
- data_device_handle_leave,
- data_device_handle_motion,
- data_device_handle_drop,
- data_device_handle_selection
-};
-
static void registry_handle_global(void *data, struct wl_registry *reg,
uint32_t id, const char *interface,
uint32_t version)
@@ -652,22 +559,11 @@ static void registry_handle_global(void *data, struct wl_registry *reg,
wl_list_insert(&wl->display.output_list, &output->link);
}
- else if (strcmp(interface, "wl_data_device_manager") == 0) {
-
- wl->input.devman = wl_registry_bind(reg,
- id,
- &wl_data_device_manager_interface,
- 1);
- }
-
else if (strcmp(interface, "wl_seat") == 0) {
wl->input.seat = wl_registry_bind(reg, id, &wl_seat_interface, 4);
wl_seat_add_listener(wl->input.seat, &seat_listener, wl);
- wl->input.datadev = wl_data_device_manager_get_data_device(
- wl->input.devman, wl->input.seat);
- wl_data_device_add_listener(wl->input.datadev, &data_device_listener, wl);
}
else if (strcmp(interface, "wl_subcompositor") == 0) {
@@ -974,8 +870,6 @@ static bool create_input(struct vo_wayland_state *wl)
return false;
}
- wl->input.dnd_fd = -1;
-
return true;
}
@@ -993,12 +887,6 @@ static void destroy_input(struct vo_wayland_state *wl)
if (wl->input.pointer)
wl_pointer_destroy(wl->input.pointer);
- if (wl->input.datadev)
- wl_data_device_destroy(wl->input.datadev);
-
- if (wl->input.devman)
- wl_data_device_manager_destroy(wl->input.devman);
-
if (wl->input.seat)
wl_seat_destroy(wl->input.seat);
}
@@ -1096,76 +984,6 @@ static void vo_wayland_fullscreen(struct vo *vo)
}
}
-static int vo_wayland_check_events(struct vo *vo)
-{
- struct vo_wayland_state *wl = vo->wayland;
-
- vo_wayland_wait_events(vo, 0);
-
- /* If drag & drop was ended poll the file descriptor from the offer if
- * there is data to read.
- * We only accept the mime type text/uri-list.
- */
- if (wl->input.dnd_fd != -1) {
- struct pollfd fd = {
- wl->input.dnd_fd,
- POLLIN | POLLERR | POLLHUP,
- 0
- };
-
- if (poll(&fd, 1, 0) > 0) {
- if (fd.revents & POLLERR) {
- MP_ERR(wl, "error occurred on the drag&drop fd\n");
- close(wl->input.dnd_fd);
- wl->input.dnd_fd = -1;
- }
-
- if (fd.revents & POLLIN) {
- int const to_read = 2048;
- char *buffer = malloc(to_read);
- size_t buffer_len = to_read;
- size_t str_len = 0;
- int has_read = 0;
-
- if (!buffer)
- goto fail;
-
- while (0 < (has_read = read(fd.fd, buffer+str_len, to_read))) {
- if (buffer_len + to_read < buffer_len) {
- MP_ERR(wl, "Integer overflow while reading from fd\n");
- break;
- }
-
- str_len += has_read;
- buffer_len += to_read;
- void *ptr = realloc(buffer, buffer_len);
- if (!ptr)
- break;
- buffer = ptr;
-
- if (has_read < to_read) {
- buffer[str_len] = 0;
- struct bstr file_list = bstr0(buffer);
- mp_event_drop_mime_data(vo->input_ctx, "text/uri-list",
- file_list, DND_REPLACE);
- break;
- }
- }
- fail:
- free(buffer);
- }
-
- if (fd.revents & POLLHUP) {
- close(wl->input.dnd_fd);
- wl->input.dnd_fd = -1;
- }
- }
- }
-
- // window events are reset by the resizing code
- return wl->window.events;
-}
-
static void vo_wayland_update_screeninfo(struct vo *vo, struct mp_rect *screenrc)
{
struct vo_wayland_state *wl = vo->wayland;
@@ -1216,7 +1034,7 @@ int vo_wayland_control(struct vo *vo, int *events, int request, void *arg)
switch (request) {
case VOCTRL_CHECK_EVENTS:
- *events |= vo_wayland_check_events(vo);
+ *events |= wl->window.events;
return VO_TRUE;
case VOCTRL_FULLSCREEN:
vo->opts->fullscreen = !vo->opts->fullscreen;
diff --git a/video/out/wayland_common.h b/video/out/wayland_common.h
index cf659fb8e6..4bb90d6520 100644
--- a/video/out/wayland_common.h
+++ b/video/out/wayland_common.h
@@ -136,11 +136,6 @@ struct vo_wayland_state {
struct xkb_keymap *keymap;
struct xkb_state *state;
} xkb;
-
- struct wl_data_device_manager *devman;
- struct wl_data_device *datadev;
- struct wl_data_offer *offer;
- int dnd_fd;
} input;
};