Implement the rest of the the data_offer listener callbacks

This commit is contained in:
Kovid Goyal 2018-09-05 19:58:55 +05:30
parent b2aa07d29f
commit 6a3d6191bd
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 23 additions and 0 deletions

2
glfw/wl_platform.h vendored
View File

@ -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

21
glfw/wl_window.c vendored
View File

@ -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) {