mirror of
https://github.com/Ryujinx/SDL.git
synced 2025-03-22 15:45:09 +00:00
Wayland / Drag and Drop: find the current window
This commit is contained in:
parent
c7f22f0324
commit
0a9f61fbf1
|
@ -75,6 +75,7 @@ typedef struct
|
|||
uint32_t drag_serial;
|
||||
SDL_WaylandDataOffer *drag_offer;
|
||||
SDL_WaylandDataOffer *selection_offer;
|
||||
SDL_Window *dnd_window;
|
||||
|
||||
/* Clipboard and Primary Selection */
|
||||
uint32_t selection_serial;
|
||||
|
|
|
@ -1558,6 +1558,14 @@ static void data_device_handle_enter(void *data, struct wl_data_device *wl_data_
|
|||
wl_data_offer_set_actions(data_device->drag_offer->offer,
|
||||
dnd_action, dnd_action);
|
||||
}
|
||||
|
||||
/* find the current window */
|
||||
if (surface && SDL_WAYLAND_own_surface(surface)) {
|
||||
SDL_WindowData *window = (SDL_WindowData *)wl_surface_get_user_data(surface);
|
||||
if (window) {
|
||||
data_device->dnd_window = window->sdlwindow;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1713,11 +1721,11 @@ static void data_device_handle_drop(void *data, struct wl_data_device *wl_data_d
|
|||
while (token != NULL) {
|
||||
char *fn = Wayland_URIToLocal(token);
|
||||
if (fn) {
|
||||
SDL_SendDropFile(NULL, fn); /* FIXME: Window? */
|
||||
SDL_SendDropFile(data_device->dnd_window, fn);
|
||||
}
|
||||
token = SDL_strtokr(NULL, "\r\n", &saveptr);
|
||||
}
|
||||
SDL_SendDropComplete(NULL); /* FIXME: Window? */
|
||||
SDL_SendDropComplete(data_device->dnd_window);
|
||||
SDL_free(buffer);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue