From 8f050b56559910641895b5cc4f5d374879dd249d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Fri, 8 Apr 2022 17:09:04 +0200 Subject: [PATCH] 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 --- src/wl_init.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/wl_init.c b/src/wl_init.c index c4e47e99..c232ce79 100644 --- a/src/wl_init.c +++ b/src/wl_init.c @@ -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,