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...
main
David Gow 2021-07-28 18:06:34 +08:00 committed by Ozkan Sezer
parent 21cba92423
commit 18303c92bc
1 changed files with 6 additions and 2 deletions

View File

@ -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"