From 151cdfa99fd154885595d53a7a6c1b89514a8f6b Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 8 Nov 2023 11:45:55 -0800
Subject: [PATCH] Added the "SDL.window.wayland.registry" property
Fixes https://github.com/libsdl-org/SDL/issues/8393
---
include/SDL3/SDL_video.h | 1 +
src/video/wayland/SDL_waylandwindow.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/include/SDL3/SDL_video.h b/include/SDL3/SDL_video.h
index 567e9437fb4b..8c89fae443a2 100644
--- a/include/SDL3/SDL_video.h
+++ b/include/SDL3/SDL_video.h
@@ -967,6 +967,7 @@ extern DECLSPEC SDL_Window *SDLCALL SDL_GetWindowParent(SDL_Window *window);
* "SDL.window.win32.instance" - the HINSTANCE associated with the window
*
* On Wayland:
+ * "SDL.window.wayland.registry" - the wl_registry associated with the window
* "SDL.window.wayland.display" - the wl_display associated with the window
* "SDL.window.wayland.surface" - the wl_surface associated with the window
* "SDL.window.wayland.egl_window" - the wl_egl_window associated with the window
diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c
index f65c3cfe186f..7e00c63a3886 100644
--- a/src/video/wayland/SDL_waylandwindow.c
+++ b/src/video/wayland/SDL_waylandwindow.c
@@ -2098,6 +2098,7 @@ int Wayland_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window)
} /* All other cases will be WAYLAND_SURFACE_UNKNOWN */
SDL_PropertiesID props = SDL_GetWindowProperties(window);
+ SDL_SetProperty(props, "SDL.window.wayland.registry", c->registry);
SDL_SetProperty(props, "SDL.window.wayland.display", data->waylandData->display);
SDL_SetProperty(props, "SDL.window.wayland.surface", data->surface);
SDL_SetProperty(props, "SDL.window.wayland.egl_window", data->egl_window);