Skip to content

Commit

Permalink
wayland: Support building with static wayland/libdecor (fix libsdl-or…
Browse files Browse the repository at this point in the history
…g#4543)

When wayland is not dynamically linked (--enable-wayland-shared=no),
libdecor is always also statically linked (it's treated as part of
Wayland in SDL_waylanddyn.{c,h} and SDL_waylandsym.h). However, it
doesn't include libdecor.h unless SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC is
set, so it fails to build at all unless Wayland is dynamically loaded.

This is @sezero's suggested fix of simply moving the libdecor.h include
outside the #ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC block:
libsdl-org#4543 (comment)

Note that this doesn't fix any of the underlying issues of libdecor
being treated as part of wayland, it just fixes the build.
  • Loading branch information
sulix committed Jul 28, 2021
1 parent 7b239ed commit 03b08ef
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/video/wayland/SDL_waylanddyn.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ enum libdecor_window_state;
#include "xkbcommon/xkbcommon.h"
#include "xkbcommon/xkbcommon-compose.h"

#ifdef HAVE_LIBDECOR_H
/* Must be included before our defines */
#include <libdecor.h>
#endif

#ifdef __cplusplus
extern "C"
{
Expand Down Expand Up @@ -115,8 +120,6 @@ void SDL_WAYLAND_UnloadSymbols(void);
#define wl_data_device_manager_interface (*WAYLAND_wl_data_device_manager_interface)

#ifdef HAVE_LIBDECOR_H
/* Must be included before our defines */
#include <libdecor.h>

#define libdecor_unref (*WAYLAND_libdecor_unref)
#define libdecor_new (*WAYLAND_libdecor_new)
Expand Down

0 comments on commit 03b08ef

Please sign in to comment.