From 3383436068f436eb0d4d4e182029e4a6404e9617 Mon Sep 17 00:00:00 2001
From: Frank Praznik <[EMAIL REDACTED]>
Date: Tue, 28 Oct 2025 11:43:45 -0400
Subject: [PATCH] wayland: Fix libdecor incompatible pointer types
---
src/video/wayland/SDL_waylandsym.h | 4 ++--
src/video/wayland/SDL_waylandwindow.c | 10 ++++------
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/src/video/wayland/SDL_waylandsym.h b/src/video/wayland/SDL_waylandsym.h
index a1e9dab7fd7d3..b5a51c9e7ce51 100644
--- a/src/video/wayland/SDL_waylandsym.h
+++ b/src/video/wayland/SDL_waylandsym.h
@@ -175,10 +175,10 @@ SDL_WAYLAND_SYM(xkb_mod_mask_t, xkb_keymap_mod_get_mask, (struct xkb_keymap *, c
#ifdef HAVE_LIBDECOR_H
SDL_WAYLAND_MODULE(WAYLAND_LIBDECOR)
SDL_WAYLAND_SYM(void, libdecor_unref, (struct libdecor *))
-SDL_WAYLAND_SYM(struct libdecor *, libdecor_new, (struct wl_display *, struct libdecor_interface *))
+SDL_WAYLAND_SYM(struct libdecor *, libdecor_new, (struct wl_display *, const struct libdecor_interface *))
SDL_WAYLAND_SYM(struct libdecor_frame *, libdecor_decorate, (struct libdecor *,\
struct wl_surface *,\
- struct libdecor_frame_interface *,\
+ const struct libdecor_frame_interface *,\
void *))
SDL_WAYLAND_SYM(void, libdecor_frame_unref, (struct libdecor_frame *))
SDL_WAYLAND_SYM(void, libdecor_frame_set_title, (struct libdecor_frame *, const char *))
diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c
index c400760a46008..fb9334e5ac8f6 100644
--- a/src/video/wayland/SDL_waylandwindow.c
+++ b/src/video/wayland/SDL_waylandwindow.c
@@ -1476,17 +1476,13 @@ static void decoration_dismiss_popup(struct libdecor_frame *frame, const char *s
// NOP
}
+#if SDL_LIBDECOR_CHECK_VERSION(0, 3, 0)
static void decoration_frame_bounds(struct libdecor_frame *frame, int width, int height, void *user_data)
{
SDL_WindowData *window = (SDL_WindowData *)user_data;
window->toplevel_bounds.width = width;
window->toplevel_bounds.height = height;
}
-
-#if SDL_LIBDECOR_CHECK_VERSION(0, 3, 0)
-#define FRAME_BOUNDS_FUNC_CAST(func) func
-#else
-#define FRAME_BOUNDS_FUNC_CAST(func) (void(*)(void))func
#endif
static struct libdecor_frame_interface libdecor_frame_interface = {
@@ -1494,7 +1490,9 @@ static struct libdecor_frame_interface libdecor_frame_interface = {
decoration_frame_close,
decoration_frame_commit,
decoration_dismiss_popup,
- FRAME_BOUNDS_FUNC_CAST(decoration_frame_bounds)
+#if SDL_LIBDECOR_CHECK_VERSION(0, 3, 0)
+ decoration_frame_bounds
+#endif
};
#endif