wayland: libdecor support for GetWindowWMInfo
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
diff --git a/src/video/wayland/SDL_waylanddyn.h b/src/video/wayland/SDL_waylanddyn.h
index 567c7bc..62963a5 100644
--- a/src/video/wayland/SDL_waylanddyn.h
+++ b/src/video/wayland/SDL_waylanddyn.h
@@ -138,6 +138,7 @@ void SDL_WAYLAND_UnloadSymbols(void);
#define libdecor_frame_set_visibility (*WAYLAND_libdecor_frame_set_visibility)
#define libdecor_frame_is_visible (*WAYLAND_libdecor_frame_is_visible)
#define libdecor_frame_is_floating (*WAYLAND_libdecor_frame_is_floating)
+#define libdecor_frame_get_xdg_surface (*WAYLAND_libdecor_frame_get_xdg_surface)
#define libdecor_frame_map (*WAYLAND_libdecor_frame_map)
#define libdecor_state_new (*WAYLAND_libdecor_state_new)
#define libdecor_state_free (*WAYLAND_libdecor_state_free)
diff --git a/src/video/wayland/SDL_waylandsym.h b/src/video/wayland/SDL_waylandsym.h
index e14d33f..5e25e89 100644
--- a/src/video/wayland/SDL_waylandsym.h
+++ b/src/video/wayland/SDL_waylandsym.h
@@ -179,6 +179,7 @@ SDL_WAYLAND_SYM(bool, libdecor_frame_has_capability, (struct libdecor_frame *, \
SDL_WAYLAND_SYM(void, libdecor_frame_set_visibility, (struct libdecor_frame *, bool))
SDL_WAYLAND_SYM(bool, libdecor_frame_is_visible, (struct libdecor_frame *))
SDL_WAYLAND_SYM(bool, libdecor_frame_is_floating, (struct libdecor_frame *))
+SDL_WAYLAND_SYM(struct xdg_surface *, libdecor_frame_get_xdg_surface, (struct libdecor_frame *))
SDL_WAYLAND_SYM(void, libdecor_frame_map, (struct libdecor_frame *))
SDL_WAYLAND_SYM(struct libdecor_state *, libdecor_state_new, (int, int))
SDL_WAYLAND_SYM(void, libdecor_state_free, (struct libdecor_state *))
diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c
index f4e4f5a..424a6a6 100644
--- a/src/video/wayland/SDL_waylandwindow.c
+++ b/src/video/wayland/SDL_waylandwindow.c
@@ -536,6 +536,7 @@ static const struct wl_surface_listener surface_listener = {
SDL_bool
Wayland_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
{
+ SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata;
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
const Uint32 version = SDL_VERSIONNUM((Uint32)info->version.major,
(Uint32)info->version.minor,
@@ -564,7 +565,16 @@ Wayland_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
}
info->info.wl.shell_surface = NULL;
- info->info.wl.xdg_surface = data->shell_surface.xdg.surface;
+#ifdef HAVE_LIBDECOR_H
+ if (viddata->shell.libdecor && data->shell_surface.libdecor.frame != NULL) {
+ info->info.wl.xdg_surface = libdecor_frame_get_xdg_surface(data->shell_surface.libdecor.frame);
+ } else
+#endif
+ if (viddata->shell.xdg && data->shell_surface.xdg.surface != NULL) {
+ info->info.wl.xdg_surface = data->shell_surface.xdg.surface;
+ } else {
+ info->info.wl.xdg_surface = NULL;
+ }
info->subsystem = SDL_SYSWM_WAYLAND;