SDL2/0001-wayland-Expose-xdg_toplevel-to-SysWM.patch
Neal Gompa bc2648e525 Backport select fixes from upstream
- Support legacy 'pulse' alias for PulseAudio driver
- Fix handling of Ctrl key on Wayland
- Add support for HiDPI cursors on Wayland
- Fix keymap support on Wayland (rhbz#2007969)
- Use EGL_EXT_present_opaque when available on Wayland
- Expose xdg_toplevel to SysWM on Wayland
2021-09-26 14:45:25 -04:00

76 lines
3.9 KiB
Diff

From b592e78f93b1e698b981ecf5af90e48e52e6387e Mon Sep 17 00:00:00 2001
From: Cacodemon345 <wahil1976@outlook.com>
Date: Sat, 25 Sep 2021 12:55:41 +0600
Subject: [PATCH] wayland: Expose xdg_toplevel to SysWM
---
include/SDL_syswm.h | 1 +
src/video/wayland/SDL_waylanddyn.h | 1 +
src/video/wayland/SDL_waylandsym.h | 1 +
src/video/wayland/SDL_waylandwindow.c | 7 +++++++
4 files changed, 10 insertions(+)
diff --git a/include/SDL_syswm.h b/include/SDL_syswm.h
index 046a096ee..0936727b1 100644
--- a/include/SDL_syswm.h
+++ b/include/SDL_syswm.h
@@ -292,6 +292,7 @@ struct SDL_SysWMinfo
void *shell_surface; /**< DEPRECATED Wayland shell_surface (window manager handle) */
struct wl_egl_window *egl_window; /**< Wayland EGL window (native window) */
struct xdg_surface *xdg_surface; /**< Wayland xdg surface (window manager handle) */
+ struct xdg_toplevel *xdg_toplevel; /**< Wayland xdg toplevel role */
} wl;
#endif
#if defined(SDL_VIDEO_DRIVER_MIR) /* no longer available, left for API/ABI compatibility. Remove in 2.1! */
diff --git a/src/video/wayland/SDL_waylanddyn.h b/src/video/wayland/SDL_waylanddyn.h
index 6cd527316..13b0884d0 100644
--- a/src/video/wayland/SDL_waylanddyn.h
+++ b/src/video/wayland/SDL_waylanddyn.h
@@ -140,6 +140,7 @@ void SDL_WAYLAND_UnloadSymbols(void);
#define libdecor_frame_is_floating (*WAYLAND_libdecor_frame_is_floating)
#define libdecor_frame_set_parent (*WAYLAND_libdecor_frame_set_parent)
#define libdecor_frame_get_xdg_surface (*WAYLAND_libdecor_frame_get_xdg_surface)
+#define libdecor_frame_get_xdg_toplevel (*WAYLAND_libdecor_frame_get_xdg_toplevel)
#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 10602740b..40e6c99a1 100644
--- a/src/video/wayland/SDL_waylandsym.h
+++ b/src/video/wayland/SDL_waylandsym.h
@@ -182,6 +182,7 @@ SDL_WAYLAND_SYM(bool, libdecor_frame_is_floating, (struct libdecor_frame *))
SDL_WAYLAND_SYM(void, libdecor_frame_set_parent, (struct libdecor_frame *,\
struct libdecor_frame *))
SDL_WAYLAND_SYM(struct xdg_surface *, libdecor_frame_get_xdg_surface, (struct libdecor_frame *))
+SDL_WAYLAND_SYM(struct xdg_toplevel *, libdecor_frame_get_xdg_toplevel, (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 451d33b76..2dd251aba 100644
--- a/src/video/wayland/SDL_waylandwindow.c
+++ b/src/video/wayland/SDL_waylandwindow.c
@@ -639,12 +639,19 @@ Wayland_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
#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);
+ if (version >= SDL_VERSIONNUM(2, 0, 17)) {
+ info->info.wl.xdg_toplevel = libdecor_frame_get_xdg_toplevel(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;
+ if (version >= SDL_VERSIONNUM(2, 0, 17)) {
+ info->info.wl.xdg_toplevel = data->shell_surface.xdg.roleobj.toplevel;
+ }
} else {
info->info.wl.xdg_surface = NULL;
+ info->info.wl.xdg_toplevel = NULL;
}
}
--
2.32.0