From ee062c644a81a002f4244ae612178210ba77d6e8 Mon Sep 17 00:00:00 2001
From: Christian Rauch <[EMAIL REDACTED]>
Date: Wed, 19 May 2021 00:13:39 +0100
Subject: [PATCH] wayland: implement toggling decorations
---
src/video/wayland/SDL_waylanddyn.h | 2 ++
src/video/wayland/SDL_waylandsym.h | 2 ++
src/video/wayland/SDL_waylandwindow.c | 4 +++-
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/video/wayland/SDL_waylanddyn.h b/src/video/wayland/SDL_waylanddyn.h
index 7233fef66f..d33c4e8e1b 100644
--- a/src/video/wayland/SDL_waylanddyn.h
+++ b/src/video/wayland/SDL_waylanddyn.h
@@ -139,6 +139,8 @@ void SDL_WAYLAND_UnloadSymbols(void);
#define libdecor_frame_set_capabilities (*WAYLAND_libdecor_frame_set_capabilities)
#define libdecor_frame_unset_capabilities (*WAYLAND_libdecor_frame_unset_capabilities)
#define libdecor_frame_has_capability (*WAYLAND_libdecor_frame_has_capability)
+#define libdecor_frame_set_visibility (*WAYLAND_libdecor_frame_set_visibility)
+#define libdecor_frame_is_visible (*WAYLAND_libdecor_frame_is_visible)
#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 d6517f7f21..7564b27435 100644
--- a/src/video/wayland/SDL_waylandsym.h
+++ b/src/video/wayland/SDL_waylandsym.h
@@ -178,6 +178,8 @@ SDL_WAYLAND_SYM(void, libdecor_frame_unset_capabilities, (struct libdecor_frame
enum libdecor_capabilities))
SDL_WAYLAND_SYM(bool, libdecor_frame_has_capability, (struct libdecor_frame *, \
enum libdecor_capabilities))
+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(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 f76eaba514..b4e89b3f2a 100644
--- a/src/video/wayland/SDL_waylandwindow.c
+++ b/src/video/wayland/SDL_waylandwindow.c
@@ -1234,7 +1234,9 @@ Wayland_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered)
const SDL_VideoData *viddata = (const SDL_VideoData *) _this->driverdata;
#ifdef HAVE_LIBDECOR_H
if (viddata->shell.libdecor) {
- SDL_SetError("FIXME libdecor: Implement toggling decorations");
+ if (wind->shell_surface.libdecor.frame) {
+ libdecor_frame_set_visibility(wind->shell_surface.libdecor.frame, bordered);
+ }
} else
#endif
if ((viddata->decoration_manager) && (wind->server_decoration)) {