2
0
Эх сурвалжийг харах

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
Camilla Löwy 3 жил өмнө
parent
commit
8f050b5655
1 өөрчлөгдсөн 25 нэмэгдсэн , 0 устгасан
  1. 25 0
      src/wl_init.c

+ 25 - 0
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,