From 6a3d6191bd8835c0df3b501cf7b0e4c3066c1df0 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 5 Sep 2018 19:58:55 +0530 Subject: [PATCH] Implement the rest of the the data_offer listener callbacks --- glfw/wl_platform.h | 2 ++ glfw/wl_window.c | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/glfw/wl_platform.h b/glfw/wl_platform.h index f237ca21e..892592e16 100644 --- a/glfw/wl_platform.h +++ b/glfw/wl_platform.h @@ -182,6 +182,8 @@ typedef struct _GLFWWaylandDataOffer int offer_type; size_t idx; int is_self_offer; + uint32_t source_actions; + uint32_t dnd_action; } _GLFWWaylandDataOffer; // Wayland-specific global data diff --git a/glfw/wl_window.c b/glfw/wl_window.c index 35b3945cf..e5a6fd2f1 100644 --- a/glfw/wl_window.c +++ b/glfw/wl_window.c @@ -1558,8 +1558,29 @@ static void handle_offer_mimetype(void *data, struct wl_data_offer* id, const ch } } +static void data_offer_source_actions(void *data, struct wl_data_offer* id, uint32_t actions) { + for (size_t i = 0; i < arraysz(_glfw.wl.dataOffers); i++) { + if (_glfw.wl.dataOffers[i].id == id) { + _glfw.wl.dataOffers[i].source_actions = actions; + break; + } + } +} + +static void data_offer_action(void *data, struct wl_data_offer* id, uint32_t action) { + for (size_t i = 0; i < arraysz(_glfw.wl.dataOffers); i++) { + if (_glfw.wl.dataOffers[i].id == id) { + _glfw.wl.dataOffers[i].dnd_action = action; + break; + } + } +} + + static const struct wl_data_offer_listener data_offer_listener = { .offer = handle_offer_mimetype, + .source_actions = data_offer_source_actions, + .action = data_offer_action, }; static void handle_data_offer(void *data, struct wl_data_device *wl_data_device, struct wl_data_offer *id) {