Commit 18303c92bc01d6ae06d78829223b566461d7f7ff

David Gow 2021-07-28T18:06:34

Wayland: Fix building with --disable-wayland-shared with libdecor. When wayland is not dynamically loaded (--enable-wayland-shared=no) libdecor.h is not included unless SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC is set, so it fails to build. We can't simply move the libdecor.h include above the #ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC block, as libdecor.h itself #includes wayland headers we need to replace with #defines. Instead, duplicate the #include. Fixes https://github.com/libsdl-org/SDL/issues/4543 Note that this doesn't fix any of the underlying issues of libdecor being treated as part of wayland, it just fixes the build. A better solution would probably be to decouple the wayland dynamic loading from the libdecor dynamic loading completely, though that is a lot more work...

diff --git a/src/video/wayland/SDL_waylanddyn.h b/src/video/wayland/SDL_waylanddyn.h
index f3e3945..567c7bc 100644
--- a/src/video/wayland/SDL_waylanddyn.h
+++ b/src/video/wayland/SDL_waylanddyn.h
@@ -18,7 +18,6 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
-
 #ifndef SDL_waylanddyn_h_
 #define SDL_waylanddyn_h_
 
@@ -68,7 +67,6 @@ void SDL_WAYLAND_UnloadSymbols(void);
 #define SDL_WAYLAND_INTERFACE(iface) extern const struct wl_interface *WAYLAND_##iface;
 #include "SDL_waylandsym.h"
 
-
 #ifdef __cplusplus
 }
 #endif
@@ -147,6 +145,12 @@ void SDL_WAYLAND_UnloadSymbols(void);
 #define libdecor_configuration_get_window_state (*WAYLAND_libdecor_configuration_get_window_state)
 #endif
 
+#else /* SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC */
+
+#ifdef HAVE_LIBDECOR_H
+#include <libdecor.h>
+#endif
+
 #endif /* SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC */
 
 #include "wayland-client-protocol.h"