diff options
author | Riteo <riteo@posteo.net> | 2022-11-29 12:03:06 +0100 |
---|---|---|
committer | Riteo <riteo@posteo.net> | 2022-12-03 19:23:43 +0100 |
commit | 2dd5a792bb95f564574449a0ccbf2ad31bf57e45 (patch) | |
tree | cade495cc829c1bf92c1a1f0ce472d018c3fbcb8 /platform/linuxbsd/x11/dynwrappers/xext-so_wrap.c | |
parent | daf168f4c821980a6a06fde67057f6a14d9e20c6 (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/xext-so_wrap.c')
-rw-r--r-- | platform/linuxbsd/x11/dynwrappers/xext-so_wrap.c | 154 |
1 files changed, 154 insertions, 0 deletions
diff --git a/platform/linuxbsd/x11/dynwrappers/xext-so_wrap.c b/platform/linuxbsd/x11/dynwrappers/xext-so_wrap.c new file mode 100644 index 0000000000..711dd3fa5e --- /dev/null +++ b/platform/linuxbsd/x11/dynwrappers/xext-so_wrap.c @@ -0,0 +1,154 @@ +// 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:51:55 +// flags: ./generate-wrapper.py --include /usr/include/X11/extensions/Xext.h --sys-include <X11/extensions/Xext.h> --include /usr/include/X11/extensions/shape.h --sys-include <X11/extensions/shape.h> --soname libXext.so.6 --init-name xext --output-header xext-so_wrap.h --output-implementation xext-so_wrap.c +// +// NOTE: Generated from Xext 1.3.5. +// 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 libXext.so.6, were removed and an include needed for +// proper parsing was added (this had also to be temporarily added to the +// original header, as dynload-wrapper would complain otherwsise) +#include <stdint.h> + +// HANDPATCH: Needed for a successful compilation. +#include <X11/Xlib.h> + +#define XShapeQueryExtension XShapeQueryExtension_dylibloader_orig_xext +#define XShapeQueryVersion XShapeQueryVersion_dylibloader_orig_xext +#define XShapeCombineRegion XShapeCombineRegion_dylibloader_orig_xext +#define XShapeCombineRectangles XShapeCombineRectangles_dylibloader_orig_xext +#define XShapeCombineMask XShapeCombineMask_dylibloader_orig_xext +#define XShapeCombineShape XShapeCombineShape_dylibloader_orig_xext +#define XShapeOffsetShape XShapeOffsetShape_dylibloader_orig_xext +#define XShapeQueryExtents XShapeQueryExtents_dylibloader_orig_xext +#define XShapeSelectInput XShapeSelectInput_dylibloader_orig_xext +#define XShapeInputSelected XShapeInputSelected_dylibloader_orig_xext +#define XShapeGetRectangles XShapeGetRectangles_dylibloader_orig_xext +#include <X11/extensions/Xext.h> +#include <X11/extensions/shape.h> +#undef XShapeQueryExtension +#undef XShapeQueryVersion +#undef XShapeCombineRegion +#undef XShapeCombineRectangles +#undef XShapeCombineMask +#undef XShapeCombineShape +#undef XShapeOffsetShape +#undef XShapeQueryExtents +#undef XShapeSelectInput +#undef XShapeInputSelected +#undef XShapeGetRectangles +#include <dlfcn.h> +#include <stdio.h> +int (*XShapeQueryExtension_dylibloader_wrapper_xext)( Display*, int*, int*); +int (*XShapeQueryVersion_dylibloader_wrapper_xext)( Display*, int*, int*); +void (*XShapeCombineRegion_dylibloader_wrapper_xext)( Display*, Window, int, int, int, Region, int); +void (*XShapeCombineRectangles_dylibloader_wrapper_xext)( Display*, Window, int, int, int, XRectangle*, int, int, int); +void (*XShapeCombineMask_dylibloader_wrapper_xext)( Display*, Window, int, int, int, Pixmap, int); +void (*XShapeCombineShape_dylibloader_wrapper_xext)( Display*, Window, int, int, int, Window, int, int); +void (*XShapeOffsetShape_dylibloader_wrapper_xext)( Display*, Window, int, int, int); +int (*XShapeQueryExtents_dylibloader_wrapper_xext)( Display*, Window, int*, int*, int*, unsigned int*, unsigned int*, int*, int*, int*, unsigned int*, unsigned int*); +void (*XShapeSelectInput_dylibloader_wrapper_xext)( Display*, Window, unsigned long); +unsigned long (*XShapeInputSelected_dylibloader_wrapper_xext)( Display*, Window); +XRectangle* (*XShapeGetRectangles_dylibloader_wrapper_xext)( Display*, Window, int, int*, int*); +int initialize_xext(int verbose) { + void *handle; + char *error; + handle = dlopen("libXext.so.6", RTLD_LAZY); + if (!handle) { + if (verbose) { + fprintf(stderr, "%s\n", dlerror()); + } + return(1); + } + dlerror(); +// XShapeQueryExtension + *(void **) (&XShapeQueryExtension_dylibloader_wrapper_xext) = dlsym(handle, "XShapeQueryExtension"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XShapeQueryVersion + *(void **) (&XShapeQueryVersion_dylibloader_wrapper_xext) = dlsym(handle, "XShapeQueryVersion"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XShapeCombineRegion + *(void **) (&XShapeCombineRegion_dylibloader_wrapper_xext) = dlsym(handle, "XShapeCombineRegion"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XShapeCombineRectangles + *(void **) (&XShapeCombineRectangles_dylibloader_wrapper_xext) = dlsym(handle, "XShapeCombineRectangles"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XShapeCombineMask + *(void **) (&XShapeCombineMask_dylibloader_wrapper_xext) = dlsym(handle, "XShapeCombineMask"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XShapeCombineShape + *(void **) (&XShapeCombineShape_dylibloader_wrapper_xext) = dlsym(handle, "XShapeCombineShape"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XShapeOffsetShape + *(void **) (&XShapeOffsetShape_dylibloader_wrapper_xext) = dlsym(handle, "XShapeOffsetShape"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XShapeQueryExtents + *(void **) (&XShapeQueryExtents_dylibloader_wrapper_xext) = dlsym(handle, "XShapeQueryExtents"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XShapeSelectInput + *(void **) (&XShapeSelectInput_dylibloader_wrapper_xext) = dlsym(handle, "XShapeSelectInput"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XShapeInputSelected + *(void **) (&XShapeInputSelected_dylibloader_wrapper_xext) = dlsym(handle, "XShapeInputSelected"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +// XShapeGetRectangles + *(void **) (&XShapeGetRectangles_dylibloader_wrapper_xext) = dlsym(handle, "XShapeGetRectangles"); + if (verbose) { + error = dlerror(); + if (error != NULL) { + fprintf(stderr, "%s\n", error); + } + } +return 0; +} |