From c20ab7dae9dbbd97f8049819a7b509f4e776beb9 Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Fri, 30 Jul 2021 00:22:50 -0400 Subject: [PATCH] wayland: Fix GetWindowWMInfo for <2.0.15 --- src/video/wayland/SDL_waylandwindow.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c index dc865bb2c..209b9e9ec 100644 --- a/src/video/wayland/SDL_waylandwindow.c +++ b/src/video/wayland/SDL_waylandwindow.c @@ -562,22 +562,24 @@ Wayland_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) info->info.wl.display = data->waylandData->display; info->info.wl.surface = data->surface; + if (version >= SDL_VERSIONNUM(2, 0, 15)) { info->info.wl.egl_window = data->egl_window; - } - info->info.wl.shell_surface = NULL; #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 + 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; + 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; + } } + /* Deprecated in 2.0.16 */ + info->info.wl.shell_surface = NULL; info->subsystem = SDL_SYSWM_WAYLAND;