From a284b25d1d8105ded38a8ceb02f30a50b21a9658 Mon Sep 17 00:00:00 2001 From: nia Date: Wed, 11 Dec 2019 21:03:19 +0000 Subject: [PATCH 1/2] Implement some stubs for newer protocol bits in the data manager, and claim support for protocol version 3. This is enough to allow some SDL2 applications to work. --- libswc/data.c | 15 +++++++++++++++ libswc/data_device.c | 9 +++++++++ libswc/data_device_manager.c | 6 +++--- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/libswc/data.c b/libswc/data.c index b97d8dc..31679cf 100644 --- a/libswc/data.c +++ b/libswc/data.c @@ -60,10 +60,25 @@ offer_receive(struct wl_client *client, struct wl_resource *offer, const char *m close(fd); } +static void +offer_finish(struct wl_client *client, struct wl_resource *offer) +{ + /* XXX: Implement */ +} + +static void +offer_set_actions(struct wl_client *client, struct wl_resource *offer, + uint32_t dnd_actions, uint32_t preferred_action) +{ + /* XXX: Implement */ +} + static const struct wl_data_offer_interface data_offer_impl = { .accept = offer_accept, .receive = offer_receive, .destroy = destroy_resource, + .finish = offer_finish, + .set_actions = offer_set_actions, }; static void diff --git a/libswc/data_device.c b/libswc/data_device.c index 7361df7..9257775 100644 --- a/libswc/data_device.c +++ b/libswc/data_device.c @@ -26,6 +26,14 @@ #include "event.h" #include "util.h" +static void +release(struct wl_client *client, struct wl_resource *resource) +{ + struct data_device *data_device = wl_resource_get_user_data(resource); + + data_device_destroy(data_device); +} + static void start_drag(struct wl_client *client, struct wl_resource *resource, struct wl_resource *source_resource, struct wl_resource *origin_resource, @@ -59,6 +67,7 @@ set_selection(struct wl_client *client, struct wl_resource *resource, struct wl_ static const struct wl_data_device_interface data_device_impl = { .start_drag = start_drag, .set_selection = set_selection, + .release = release }; static void diff --git a/libswc/data_device_manager.c b/libswc/data_device_manager.c index f21a6a1..eea7439 100644 --- a/libswc/data_device_manager.c +++ b/libswc/data_device_manager.c @@ -56,8 +56,8 @@ bind_data_device_manager(struct wl_client *client, void *data, uint32_t version, { struct wl_resource *resource; - if (version > 1) - version = 1; + if (version > 3) + version = 3; resource = wl_resource_create(client, &wl_data_device_manager_interface, version, id); wl_resource_set_implementation(resource, &data_device_manager_impl, NULL, NULL); @@ -66,5 +66,5 @@ bind_data_device_manager(struct wl_client *client, void *data, uint32_t version, struct wl_global * data_device_manager_create(struct wl_display *display) { - return wl_global_create(display, &wl_data_device_manager_interface, 1, NULL, &bind_data_device_manager); + return wl_global_create(display, &wl_data_device_manager_interface, 3, NULL, &bind_data_device_manager); } From 6298612ea789eebc5814f41c8a5d9a10da26309e Mon Sep 17 00:00:00 2001 From: nia Date: Wed, 18 Dec 2019 14:40:27 +0000 Subject: [PATCH 2/2] Use destroy_resource instead of implementing `release` --- libswc/data_device.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/libswc/data_device.c b/libswc/data_device.c index 9257775..c594604 100644 --- a/libswc/data_device.c +++ b/libswc/data_device.c @@ -26,14 +26,6 @@ #include "event.h" #include "util.h" -static void -release(struct wl_client *client, struct wl_resource *resource) -{ - struct data_device *data_device = wl_resource_get_user_data(resource); - - data_device_destroy(data_device); -} - static void start_drag(struct wl_client *client, struct wl_resource *resource, struct wl_resource *source_resource, struct wl_resource *origin_resource, @@ -67,7 +59,7 @@ set_selection(struct wl_client *client, struct wl_resource *resource, struct wl_ static const struct wl_data_device_interface data_device_impl = { .start_drag = start_drag, .set_selection = set_selection, - .release = release + .release = destroy_resource }; static void