| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
#include <stdint.h> |
| 7 |
|
| 8 |
#include "thirdparty/linuxbsd_headers/X11/Xlib.h" |
| 9 |
#define XShapeQueryExtension XShapeQueryExtension_dylibloader_orig_xext |
| 10 |
#define XShapeQueryVersion XShapeQueryVersion_dylibloader_orig_xext |
| 11 |
#define XShapeCombineRegion XShapeCombineRegion_dylibloader_orig_xext |
| 12 |
#define XShapeCombineRectangles XShapeCombineRectangles_dylibloader_orig_xext |
| 13 |
#define XShapeCombineMask XShapeCombineMask_dylibloader_orig_xext |
| 14 |
#define XShapeCombineShape XShapeCombineShape_dylibloader_orig_xext |
| 15 |
#define XShapeOffsetShape XShapeOffsetShape_dylibloader_orig_xext |
| 16 |
#define XShapeQueryExtents XShapeQueryExtents_dylibloader_orig_xext |
| 17 |
#define XShapeSelectInput XShapeSelectInput_dylibloader_orig_xext |
| 18 |
#define XShapeInputSelected XShapeInputSelected_dylibloader_orig_xext |
| 19 |
#define XShapeGetRectangles XShapeGetRectangles_dylibloader_orig_xext |
| 20 |
#include "thirdparty/linuxbsd_headers/X11/extensions/Xext.h" |
| 21 |
#include "thirdparty/linuxbsd_headers/X11/extensions/shape.h" |
| 22 |
#undef XShapeQueryExtension |
| 23 |
#undef XShapeQueryVersion |
| 24 |
#undef XShapeCombineRegion |
| 25 |
#undef XShapeCombineRectangles |
| 26 |
#undef XShapeCombineMask |
| 27 |
#undef XShapeCombineShape |
| 28 |
#undef XShapeOffsetShape |
| 29 |
#undef XShapeQueryExtents |
| 30 |
#undef XShapeSelectInput |
| 31 |
#undef XShapeInputSelected |
| 32 |
#undef XShapeGetRectangles |
| 33 |
#include <dlfcn.h> |
| 34 |
#include <stdio.h> |
| 35 |
int (*XShapeQueryExtension_dylibloader_wrapper_xext)(Display *, int *, int *); |
| 36 |
int (*XShapeQueryVersion_dylibloader_wrapper_xext)(Display *, int *, int *); |
| 37 |
void (*XShapeCombineRegion_dylibloader_wrapper_xext)(Display *, Window, int, int, int, Region, int); |
| 38 |
void (*XShapeCombineRectangles_dylibloader_wrapper_xext)(Display *, Window, int, int, int, XRectangle *, int, int, int); |
| 39 |
void (*XShapeCombineMask_dylibloader_wrapper_xext)(Display *, Window, int, int, int, Pixmap, int); |
| 40 |
void (*XShapeCombineShape_dylibloader_wrapper_xext)(Display *, Window, int, int, int, Window, int, int); |
| 41 |
void (*XShapeOffsetShape_dylibloader_wrapper_xext)(Display *, Window, int, int, int); |
| 42 |
int (*XShapeQueryExtents_dylibloader_wrapper_xext)(Display *, Window, int *, int *, int *, unsigned int *, unsigned int *, int *, int *, int *, unsigned int *, unsigned int *); |
| 43 |
void (*XShapeSelectInput_dylibloader_wrapper_xext)(Display *, Window, unsigned long); |
| 44 |
unsigned long (*XShapeInputSelected_dylibloader_wrapper_xext)(Display *, Window); |
| 45 |
XRectangle *(*XShapeGetRectangles_dylibloader_wrapper_xext)(Display *, Window, int, int *, int *); |
| 46 |
int initialize_xext(int verbose) { |
| 47 |
void *handle; |
| 48 |
char *error; |
| 49 |
handle = dlopen("libXext.so.6", RTLD_LAZY); |
| 50 |
if (!handle) { |
| 51 |
if (verbose) { |
| 52 |
fprintf(stderr, "%s\n", dlerror()); |
| 53 |
} |
| 54 |
return(1); |
| 55 |
} |
| 56 |
dlerror(); |
| 57 |
|
| 58 |
*(void **) (&XShapeQueryExtension_dylibloader_wrapper_xext) = dlsym(handle, "XShapeQueryExtension"); |
| 59 |
if (verbose) { |
| 60 |
error = dlerror(); |
| 61 |
if (error != NULL) { |
| 62 |
fprintf(stderr, "%s\n", error); |
| 63 |
} |
| 64 |
} |
| 65 |
|
| 66 |
*(void **) (&XShapeQueryVersion_dylibloader_wrapper_xext) = dlsym(handle, "XShapeQueryVersion"); |
| 67 |
if (verbose) { |
| 68 |
error = dlerror(); |
| 69 |
if (error != NULL) { |
| 70 |
fprintf(stderr, "%s\n", error); |
| 71 |
} |
| 72 |
} |
| 73 |
|
| 74 |
*(void **) (&XShapeCombineRegion_dylibloader_wrapper_xext) = dlsym(handle, "XShapeCombineRegion"); |
| 75 |
if (verbose) { |
| 76 |
error = dlerror(); |
| 77 |
if (error != NULL) { |
| 78 |
fprintf(stderr, "%s\n", error); |
| 79 |
} |
| 80 |
} |
| 81 |
|
| 82 |
*(void **) (&XShapeCombineRectangles_dylibloader_wrapper_xext) = dlsym(handle, "XShapeCombineRectangles"); |
| 83 |
if (verbose) { |
| 84 |
error = dlerror(); |
| 85 |
if (error != NULL) { |
| 86 |
fprintf(stderr, "%s\n", error); |
| 87 |
} |
| 88 |
} |
| 89 |
|
| 90 |
*(void **) (&XShapeCombineMask_dylibloader_wrapper_xext) = dlsym(handle, "XShapeCombineMask"); |
| 91 |
if (verbose) { |
| 92 |
error = dlerror(); |
| 93 |
if (error != NULL) { |
| 94 |
fprintf(stderr, "%s\n", error); |
| 95 |
} |
| 96 |
} |
| 97 |
|
| 98 |
*(void **) (&XShapeCombineShape_dylibloader_wrapper_xext) = dlsym(handle, "XShapeCombineShape"); |
| 99 |
if (verbose) { |
| 100 |
error = dlerror(); |
| 101 |
if (error != NULL) { |
| 102 |
fprintf(stderr, "%s\n", error); |
| 103 |
} |
| 104 |
} |
| 105 |
|
| 106 |
*(void **) (&XShapeOffsetShape_dylibloader_wrapper_xext) = dlsym(handle, "XShapeOffsetShape"); |
| 107 |
if (verbose) { |
| 108 |
error = dlerror(); |
| 109 |
if (error != NULL) { |
| 110 |
fprintf(stderr, "%s\n", error); |
| 111 |
} |
| 112 |
} |
| 113 |
|
| 114 |
*(void **) (&XShapeQueryExtents_dylibloader_wrapper_xext) = dlsym(handle, "XShapeQueryExtents"); |
| 115 |
if (verbose) { |
| 116 |
error = dlerror(); |
| 117 |
if (error != NULL) { |
| 118 |
fprintf(stderr, "%s\n", error); |
| 119 |
} |
| 120 |
} |
| 121 |
|
| 122 |
*(void **) (&XShapeSelectInput_dylibloader_wrapper_xext) = dlsym(handle, "XShapeSelectInput"); |
| 123 |
if (verbose) { |
| 124 |
error = dlerror(); |
| 125 |
if (error != NULL) { |
| 126 |
fprintf(stderr, "%s\n", error); |
| 127 |
} |
| 128 |
} |
| 129 |
|
| 130 |
*(void **) (&XShapeInputSelected_dylibloader_wrapper_xext) = dlsym(handle, "XShapeInputSelected"); |
| 131 |
if (verbose) { |
| 132 |
error = dlerror(); |
| 133 |
if (error != NULL) { |
| 134 |
fprintf(stderr, "%s\n", error); |
| 135 |
} |
| 136 |
} |
| 137 |
|
| 138 |
*(void **) (&XShapeGetRectangles_dylibloader_wrapper_xext) = dlsym(handle, "XShapeGetRectangles"); |
| 139 |
if (verbose) { |
| 140 |
error = dlerror(); |
| 141 |
if (error != NULL) { |
| 142 |
fprintf(stderr, "%s\n", error); |
| 143 |
} |
| 144 |
} |
| 145 |
return 0; |
| 146 |
} |