Commit ee062c644a81a002f4244ae612178210ba77d6e8

Christian Rauch 2021-05-19T00:13:39

wayland: implement toggling decorations

diff --git a/src/video/wayland/SDL_waylanddyn.h b/src/video/wayland/SDL_waylanddyn.h
index 7233fef..d33c4e8 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 d6517f7..7564b27 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 f76eaba..b4e89b3 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)) {