Wayland: Add support for older wayland-scanner

Versions of wayland-scanner prior to 1.17.91 named every global array of
wl_interface pointers 'types', making it impossible to combine several
unmodified private-code files into a single compilation unit.

This overrides that name with a macro for each file, allowing them to
coexist.

Fixes #2016
Closes #2032
This commit is contained in:
Camilla Löwy 2022-04-08 17:09:04 +02:00
parent acf0c10e7a
commit 8f050b5655
1 changed files with 25 additions and 0 deletions

View File

@ -47,13 +47,38 @@
#include "wayland-pointer-constraints-unstable-v1-client-protocol.h"
#include "wayland-idle-inhibit-unstable-v1-client-protocol.h"
// NOTE: Versions of wayland-scanner prior to 1.17.91 named every global array of
// wl_interface pointers 'types', making it impossible to combine several unmodified
// private-code files into a single compilation unit
// HACK: We override this name with a macro for each file, allowing them to coexist
#define types _glfw_wayland_types
#include "wayland-client-protocol-code.h"
#undef types
#define types _glfw_xdg_shell_types
#include "wayland-xdg-shell-client-protocol-code.h"
#undef types
#define types _glfw_xdg_decoration_types
#include "wayland-xdg-decoration-client-protocol-code.h"
#undef types
#define types _glfw_viewporter_types
#include "wayland-viewporter-client-protocol-code.h"
#undef types
#define types _glfw_relative_pointer_types
#include "wayland-relative-pointer-unstable-v1-client-protocol-code.h"
#undef types
#define types _glfw_pointer_constraints_types
#include "wayland-pointer-constraints-unstable-v1-client-protocol-code.h"
#undef types
#define types _glfw_idle_inhibit_types
#include "wayland-idle-inhibit-unstable-v1-client-protocol-code.h"
#undef types
static void wmBaseHandlePing(void* userData,
struct xdg_wm_base* wmBase,