summaryrefslogtreecommitdiff
path: root/platform/linuxbsd/x11/dynwrappers/xinerama-so_wrap.c
diff options
context:
space:
mode:
authorRiteo <riteo@posteo.net>2022-11-29 12:03:06 +0100
committerRiteo <riteo@posteo.net>2022-12-03 19:23:43 +0100
commit2dd5a792bb95f564574449a0ccbf2ad31bf57e45 (patch)
treecade495cc829c1bf92c1a1f0ce472d018c3fbcb8 /platform/linuxbsd/x11/dynwrappers/xinerama-so_wrap.c
parentdaf168f4c821980a6a06fde67057f6a14d9e20c6 (diff)
Load X11 dynamically
The loaders have been generated through hpvb's dynload-wrapper, although they had to be heavily handpatched to workaround some already reported issues with it. I added a note to each generated file to account for that. As GLAD uses X11 stuff directly, I had to define the GLAD_GLX_NO_X11 macro to not let do it that, and handle myself the display loading and screen handling part myself, which wasn't that hard but it's still something worth saying. I plan to improve greatly the X11 backend (including this aspect) but, as the release isn't that far and I'm also working on the Wayland backend, this will do for now, I hope.
Diffstat (limited to 'platform/linuxbsd/x11/dynwrappers/xinerama-so_wrap.c')
-rw-r--r--platform/linuxbsd/x11/dynwrappers/xinerama-so_wrap.c71
1 files changed, 71 insertions, 0 deletions
diff --git a/platform/linuxbsd/x11/dynwrappers/xinerama-so_wrap.c b/platform/linuxbsd/x11/dynwrappers/xinerama-so_wrap.c
new file mode 100644
index 0000000000..42af983345
--- /dev/null
+++ b/platform/linuxbsd/x11/dynwrappers/xinerama-so_wrap.c
@@ -0,0 +1,71 @@
+// This file is generated. Do not edit!
+// see https://github.com/hpvb/dynload-wrapper for details
+// generated by ./generate-wrapper.py 0.3 on 2022-12-02 12:53:11
+// flags: ./generate-wrapper.py --include /usr/include/X11/extensions/Xinerama.h --sys-include <X11/extensions/Xinerama.h> --soname libXinerama.so.1 --init-name xinerama --output-header xinerama-so_wrap.h --output-implementation xinerama-so_wrap.c
+//
+// NOTE: Generated from Xinerama 1.1.4.
+// This has been handpatched to workaround some issues with the generator that
+// will be eventually fixed. In this case, non-existant symbols inherited from
+// libX11, but absent in libXinerama.so.1, were removed.
+#include <stdint.h>
+
+#define XineramaQueryExtension XineramaQueryExtension_dylibloader_orig_xinerama
+#define XineramaQueryVersion XineramaQueryVersion_dylibloader_orig_xinerama
+#define XineramaIsActive XineramaIsActive_dylibloader_orig_xinerama
+#define XineramaQueryScreens XineramaQueryScreens_dylibloader_orig_xinerama
+#include <X11/extensions/Xinerama.h>
+#undef XineramaQueryExtension
+#undef XineramaQueryVersion
+#undef XineramaIsActive
+#undef XineramaQueryScreens
+#include <dlfcn.h>
+#include <stdio.h>
+int (*XineramaQueryExtension_dylibloader_wrapper_xinerama)( Display*, int*, int*);
+int (*XineramaQueryVersion_dylibloader_wrapper_xinerama)( Display*, int*, int*);
+int (*XineramaIsActive_dylibloader_wrapper_xinerama)( Display*);
+XineramaScreenInfo* (*XineramaQueryScreens_dylibloader_wrapper_xinerama)( Display*, int*);
+int initialize_xinerama(int verbose) {
+ void *handle;
+ char *error;
+ handle = dlopen("libXinerama.so.1", RTLD_LAZY);
+ if (!handle) {
+ if (verbose) {
+ fprintf(stderr, "%s\n", dlerror());
+ }
+ return(1);
+ }
+ dlerror();
+// XineramaQueryExtension
+ *(void **) (&XineramaQueryExtension_dylibloader_wrapper_xinerama) = dlsym(handle, "XineramaQueryExtension");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// XineramaQueryVersion
+ *(void **) (&XineramaQueryVersion_dylibloader_wrapper_xinerama) = dlsym(handle, "XineramaQueryVersion");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// XineramaIsActive
+ *(void **) (&XineramaIsActive_dylibloader_wrapper_xinerama) = dlsym(handle, "XineramaIsActive");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+// XineramaQueryScreens
+ *(void **) (&XineramaQueryScreens_dylibloader_wrapper_xinerama) = dlsym(handle, "XineramaQueryScreens");
+ if (verbose) {
+ error = dlerror();
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error);
+ }
+ }
+return 0;
+}