| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
#include <stdint.h> |
| 7 |
|
| 8 |
#define XIQueryPointer XIQueryPointer_dylibloader_orig_xinput2 |
| 9 |
#define XIWarpPointer XIWarpPointer_dylibloader_orig_xinput2 |
| 10 |
#define XIDefineCursor XIDefineCursor_dylibloader_orig_xinput2 |
| 11 |
#define XIUndefineCursor XIUndefineCursor_dylibloader_orig_xinput2 |
| 12 |
#define XIChangeHierarchy XIChangeHierarchy_dylibloader_orig_xinput2 |
| 13 |
#define XISetClientPointer XISetClientPointer_dylibloader_orig_xinput2 |
| 14 |
#define XIGetClientPointer XIGetClientPointer_dylibloader_orig_xinput2 |
| 15 |
#define XISelectEvents XISelectEvents_dylibloader_orig_xinput2 |
| 16 |
#define XIGetSelectedEvents XIGetSelectedEvents_dylibloader_orig_xinput2 |
| 17 |
#define XIQueryVersion XIQueryVersion_dylibloader_orig_xinput2 |
| 18 |
#define XIQueryDevice XIQueryDevice_dylibloader_orig_xinput2 |
| 19 |
#define XISetFocus XISetFocus_dylibloader_orig_xinput2 |
| 20 |
#define XIGetFocus XIGetFocus_dylibloader_orig_xinput2 |
| 21 |
#define XIGrabDevice XIGrabDevice_dylibloader_orig_xinput2 |
| 22 |
#define XIUngrabDevice XIUngrabDevice_dylibloader_orig_xinput2 |
| 23 |
#define XIAllowEvents XIAllowEvents_dylibloader_orig_xinput2 |
| 24 |
#define XIAllowTouchEvents XIAllowTouchEvents_dylibloader_orig_xinput2 |
| 25 |
#define XIGrabButton XIGrabButton_dylibloader_orig_xinput2 |
| 26 |
#define XIGrabKeycode XIGrabKeycode_dylibloader_orig_xinput2 |
| 27 |
#define XIGrabEnter XIGrabEnter_dylibloader_orig_xinput2 |
| 28 |
#define XIGrabFocusIn XIGrabFocusIn_dylibloader_orig_xinput2 |
| 29 |
#define XIGrabTouchBegin XIGrabTouchBegin_dylibloader_orig_xinput2 |
| 30 |
#define XIUngrabButton XIUngrabButton_dylibloader_orig_xinput2 |
| 31 |
#define XIUngrabKeycode XIUngrabKeycode_dylibloader_orig_xinput2 |
| 32 |
#define XIUngrabEnter XIUngrabEnter_dylibloader_orig_xinput2 |
| 33 |
#define XIUngrabFocusIn XIUngrabFocusIn_dylibloader_orig_xinput2 |
| 34 |
#define XIUngrabTouchBegin XIUngrabTouchBegin_dylibloader_orig_xinput2 |
| 35 |
#define XIListProperties XIListProperties_dylibloader_orig_xinput2 |
| 36 |
#define XIChangeProperty XIChangeProperty_dylibloader_orig_xinput2 |
| 37 |
#define XIDeleteProperty XIDeleteProperty_dylibloader_orig_xinput2 |
| 38 |
#define XIGetProperty XIGetProperty_dylibloader_orig_xinput2 |
| 39 |
#define XIBarrierReleasePointers XIBarrierReleasePointers_dylibloader_orig_xinput2 |
| 40 |
#define XIBarrierReleasePointer XIBarrierReleasePointer_dylibloader_orig_xinput2 |
| 41 |
#define XIFreeDeviceInfo XIFreeDeviceInfo_dylibloader_orig_xinput2 |
| 42 |
#include "thirdparty/linuxbsd_headers/X11/extensions/XInput2.h" |
| 43 |
#undef XIQueryPointer |
| 44 |
#undef XIWarpPointer |
| 45 |
#undef XIDefineCursor |
| 46 |
#undef XIUndefineCursor |
| 47 |
#undef XIChangeHierarchy |
| 48 |
#undef XISetClientPointer |
| 49 |
#undef XIGetClientPointer |
| 50 |
#undef XISelectEvents |
| 51 |
#undef XIGetSelectedEvents |
| 52 |
#undef XIQueryVersion |
| 53 |
#undef XIQueryDevice |
| 54 |
#undef XISetFocus |
| 55 |
#undef XIGetFocus |
| 56 |
#undef XIGrabDevice |
| 57 |
#undef XIUngrabDevice |
| 58 |
#undef XIAllowEvents |
| 59 |
#undef XIAllowTouchEvents |
| 60 |
#undef XIGrabButton |
| 61 |
#undef XIGrabKeycode |
| 62 |
#undef XIGrabEnter |
| 63 |
#undef XIGrabFocusIn |
| 64 |
#undef XIGrabTouchBegin |
| 65 |
#undef XIUngrabButton |
| 66 |
#undef XIUngrabKeycode |
| 67 |
#undef XIUngrabEnter |
| 68 |
#undef XIUngrabFocusIn |
| 69 |
#undef XIUngrabTouchBegin |
| 70 |
#undef XIListProperties |
| 71 |
#undef XIChangeProperty |
| 72 |
#undef XIDeleteProperty |
| 73 |
#undef XIGetProperty |
| 74 |
#undef XIBarrierReleasePointers |
| 75 |
#undef XIBarrierReleasePointer |
| 76 |
#undef XIFreeDeviceInfo |
| 77 |
#include <dlfcn.h> |
| 78 |
#include <stdio.h> |
| 79 |
int (*XIQueryPointer_dylibloader_wrapper_xinput2)(Display *, int, Window, Window *, Window *, double *, double *, double *, double *, XIButtonState *, XIModifierState *, XIGroupState *); |
| 80 |
int (*XIWarpPointer_dylibloader_wrapper_xinput2)(Display *, int, Window, Window, double, double, unsigned int, unsigned int, double, double); |
| 81 |
int (*XIDefineCursor_dylibloader_wrapper_xinput2)(Display *, int, Window, Cursor); |
| 82 |
int (*XIUndefineCursor_dylibloader_wrapper_xinput2)(Display *, int, Window); |
| 83 |
int (*XIChangeHierarchy_dylibloader_wrapper_xinput2)(Display *, XIAnyHierarchyChangeInfo *, int); |
| 84 |
int (*XISetClientPointer_dylibloader_wrapper_xinput2)(Display *, Window, int); |
| 85 |
int (*XIGetClientPointer_dylibloader_wrapper_xinput2)(Display *, Window, int *); |
| 86 |
int (*XISelectEvents_dylibloader_wrapper_xinput2)(Display *, Window, XIEventMask *, int); |
| 87 |
XIEventMask *(*XIGetSelectedEvents_dylibloader_wrapper_xinput2)(Display *, Window, int *); |
| 88 |
int (*XIQueryVersion_dylibloader_wrapper_xinput2)(Display *, int *, int *); |
| 89 |
XIDeviceInfo *(*XIQueryDevice_dylibloader_wrapper_xinput2)(Display *, int, int *); |
| 90 |
int (*XISetFocus_dylibloader_wrapper_xinput2)(Display *, int, Window, Time); |
| 91 |
int (*XIGetFocus_dylibloader_wrapper_xinput2)(Display *, int, Window *); |
| 92 |
int (*XIGrabDevice_dylibloader_wrapper_xinput2)(Display *, int, Window, Time, Cursor, int, int, int, XIEventMask *); |
| 93 |
int (*XIUngrabDevice_dylibloader_wrapper_xinput2)(Display *, int, Time); |
| 94 |
int (*XIAllowEvents_dylibloader_wrapper_xinput2)(Display *, int, int, Time); |
| 95 |
int (*XIAllowTouchEvents_dylibloader_wrapper_xinput2)(Display *, int, unsigned int, Window, int); |
| 96 |
int (*XIGrabButton_dylibloader_wrapper_xinput2)(Display *, int, int, Window, Cursor, int, int, int, XIEventMask *, int, XIGrabModifiers *); |
| 97 |
int (*XIGrabKeycode_dylibloader_wrapper_xinput2)(Display *, int, int, Window, int, int, int, XIEventMask *, int, XIGrabModifiers *); |
| 98 |
int (*XIGrabEnter_dylibloader_wrapper_xinput2)(Display *, int, Window, Cursor, int, int, int, XIEventMask *, int, XIGrabModifiers *); |
| 99 |
int (*XIGrabFocusIn_dylibloader_wrapper_xinput2)(Display *, int, Window, int, int, int, XIEventMask *, int, XIGrabModifiers *); |
| 100 |
int (*XIGrabTouchBegin_dylibloader_wrapper_xinput2)(Display *, int, Window, int, XIEventMask *, int, XIGrabModifiers *); |
| 101 |
int (*XIUngrabButton_dylibloader_wrapper_xinput2)(Display *, int, int, Window, int, XIGrabModifiers *); |
| 102 |
int (*XIUngrabKeycode_dylibloader_wrapper_xinput2)(Display *, int, int, Window, int, XIGrabModifiers *); |
| 103 |
int (*XIUngrabEnter_dylibloader_wrapper_xinput2)(Display *, int, Window, int, XIGrabModifiers *); |
| 104 |
int (*XIUngrabFocusIn_dylibloader_wrapper_xinput2)(Display *, int, Window, int, XIGrabModifiers *); |
| 105 |
int (*XIUngrabTouchBegin_dylibloader_wrapper_xinput2)(Display *, int, Window, int, XIGrabModifiers *); |
| 106 |
Atom *(*XIListProperties_dylibloader_wrapper_xinput2)(Display *, int, int *); |
| 107 |
void (*XIChangeProperty_dylibloader_wrapper_xinput2)(Display *, int, Atom, Atom, int, int, unsigned char *, int); |
| 108 |
void (*XIDeleteProperty_dylibloader_wrapper_xinput2)(Display *, int, Atom); |
| 109 |
int (*XIGetProperty_dylibloader_wrapper_xinput2)(Display *, int, Atom, long, long, int, Atom, Atom *, int *, unsigned long *, unsigned long *, unsigned char **); |
| 110 |
void (*XIBarrierReleasePointers_dylibloader_wrapper_xinput2)(Display *, XIBarrierReleasePointerInfo *, int); |
| 111 |
void (*XIBarrierReleasePointer_dylibloader_wrapper_xinput2)(Display *, int, PointerBarrier, BarrierEventID); |
| 112 |
void (*XIFreeDeviceInfo_dylibloader_wrapper_xinput2)(XIDeviceInfo *); |
| 113 |
int initialize_xinput2(int verbose) { |
| 114 |
void *handle; |
| 115 |
char *error; |
| 116 |
handle = dlopen("libXi.so.6", RTLD_LAZY); |
| 117 |
if (!handle) { |
| 118 |
if (verbose) { |
| 119 |
fprintf(stderr, "%s\n", dlerror()); |
| 120 |
} |
| 121 |
return(1); |
| 122 |
} |
| 123 |
dlerror(); |
| 124 |
|
| 125 |
*(void **) (&XIQueryPointer_dylibloader_wrapper_xinput2) = dlsym(handle, "XIQueryPointer"); |
| 126 |
if (verbose) { |
| 127 |
error = dlerror(); |
| 128 |
if (error != NULL) { |
| 129 |
fprintf(stderr, "%s\n", error); |
| 130 |
} |
| 131 |
} |
| 132 |
|
| 133 |
*(void **) (&XIWarpPointer_dylibloader_wrapper_xinput2) = dlsym(handle, "XIWarpPointer"); |
| 134 |
if (verbose) { |
| 135 |
error = dlerror(); |
| 136 |
if (error != NULL) { |
| 137 |
fprintf(stderr, "%s\n", error); |
| 138 |
} |
| 139 |
} |
| 140 |
|
| 141 |
*(void **) (&XIDefineCursor_dylibloader_wrapper_xinput2) = dlsym(handle, "XIDefineCursor"); |
| 142 |
if (verbose) { |
| 143 |
error = dlerror(); |
| 144 |
if (error != NULL) { |
| 145 |
fprintf(stderr, "%s\n", error); |
| 146 |
} |
| 147 |
} |
| 148 |
|
| 149 |
*(void **) (&XIUndefineCursor_dylibloader_wrapper_xinput2) = dlsym(handle, "XIUndefineCursor"); |
| 150 |
if (verbose) { |
| 151 |
error = dlerror(); |
| 152 |
if (error != NULL) { |
| 153 |
fprintf(stderr, "%s\n", error); |
| 154 |
} |
| 155 |
} |
| 156 |
|
| 157 |
*(void **) (&XIChangeHierarchy_dylibloader_wrapper_xinput2) = dlsym(handle, "XIChangeHierarchy"); |
| 158 |
if (verbose) { |
| 159 |
error = dlerror(); |
| 160 |
if (error != NULL) { |
| 161 |
fprintf(stderr, "%s\n", error); |
| 162 |
} |
| 163 |
} |
| 164 |
|
| 165 |
*(void **) (&XISetClientPointer_dylibloader_wrapper_xinput2) = dlsym(handle, "XISetClientPointer"); |
| 166 |
if (verbose) { |
| 167 |
error = dlerror(); |
| 168 |
if (error != NULL) { |
| 169 |
fprintf(stderr, "%s\n", error); |
| 170 |
} |
| 171 |
} |
| 172 |
|
| 173 |
*(void **) (&XIGetClientPointer_dylibloader_wrapper_xinput2) = dlsym(handle, "XIGetClientPointer"); |
| 174 |
if (verbose) { |
| 175 |
error = dlerror(); |
| 176 |
if (error != NULL) { |
| 177 |
fprintf(stderr, "%s\n", error); |
| 178 |
} |
| 179 |
} |
| 180 |
|
| 181 |
*(void **) (&XISelectEvents_dylibloader_wrapper_xinput2) = dlsym(handle, "XISelectEvents"); |
| 182 |
if (verbose) { |
| 183 |
error = dlerror(); |
| 184 |
if (error != NULL) { |
| 185 |
fprintf(stderr, "%s\n", error); |
| 186 |
} |
| 187 |
} |
| 188 |
|
| 189 |
*(void **) (&XIGetSelectedEvents_dylibloader_wrapper_xinput2) = dlsym(handle, "XIGetSelectedEvents"); |
| 190 |
if (verbose) { |
| 191 |
error = dlerror(); |
| 192 |
if (error != NULL) { |
| 193 |
fprintf(stderr, "%s\n", error); |
| 194 |
} |
| 195 |
} |
| 196 |
|
| 197 |
*(void **) (&XIQueryVersion_dylibloader_wrapper_xinput2) = dlsym(handle, "XIQueryVersion"); |
| 198 |
if (verbose) { |
| 199 |
error = dlerror(); |
| 200 |
if (error != NULL) { |
| 201 |
fprintf(stderr, "%s\n", error); |
| 202 |
} |
| 203 |
} |
| 204 |
|
| 205 |
*(void **) (&XIQueryDevice_dylibloader_wrapper_xinput2) = dlsym(handle, "XIQueryDevice"); |
| 206 |
if (verbose) { |
| 207 |
error = dlerror(); |
| 208 |
if (error != NULL) { |
| 209 |
fprintf(stderr, "%s\n", error); |
| 210 |
} |
| 211 |
} |
| 212 |
|
| 213 |
*(void **) (&XISetFocus_dylibloader_wrapper_xinput2) = dlsym(handle, "XISetFocus"); |
| 214 |
if (verbose) { |
| 215 |
error = dlerror(); |
| 216 |
if (error != NULL) { |
| 217 |
fprintf(stderr, "%s\n", error); |
| 218 |
} |
| 219 |
} |
| 220 |
|
| 221 |
*(void **) (&XIGetFocus_dylibloader_wrapper_xinput2) = dlsym(handle, "XIGetFocus"); |
| 222 |
if (verbose) { |
| 223 |
error = dlerror(); |
| 224 |
if (error != NULL) { |
| 225 |
fprintf(stderr, "%s\n", error); |
| 226 |
} |
| 227 |
} |
| 228 |
|
| 229 |
*(void **) (&XIGrabDevice_dylibloader_wrapper_xinput2) = dlsym(handle, "XIGrabDevice"); |
| 230 |
if (verbose) { |
| 231 |
error = dlerror(); |
| 232 |
if (error != NULL) { |
| 233 |
fprintf(stderr, "%s\n", error); |
| 234 |
} |
| 235 |
} |
| 236 |
|
| 237 |
*(void **) (&XIUngrabDevice_dylibloader_wrapper_xinput2) = dlsym(handle, "XIUngrabDevice"); |
| 238 |
if (verbose) { |
| 239 |
error = dlerror(); |
| 240 |
if (error != NULL) { |
| 241 |
fprintf(stderr, "%s\n", error); |
| 242 |
} |
| 243 |
} |
| 244 |
|
| 245 |
*(void **) (&XIAllowEvents_dylibloader_wrapper_xinput2) = dlsym(handle, "XIAllowEvents"); |
| 246 |
if (verbose) { |
| 247 |
error = dlerror(); |
| 248 |
if (error != NULL) { |
| 249 |
fprintf(stderr, "%s\n", error); |
| 250 |
} |
| 251 |
} |
| 252 |
|
| 253 |
*(void **) (&XIAllowTouchEvents_dylibloader_wrapper_xinput2) = dlsym(handle, "XIAllowTouchEvents"); |
| 254 |
if (verbose) { |
| 255 |
error = dlerror(); |
| 256 |
if (error != NULL) { |
| 257 |
fprintf(stderr, "%s\n", error); |
| 258 |
} |
| 259 |
} |
| 260 |
|
| 261 |
*(void **) (&XIGrabButton_dylibloader_wrapper_xinput2) = dlsym(handle, "XIGrabButton"); |
| 262 |
if (verbose) { |
| 263 |
error = dlerror(); |
| 264 |
if (error != NULL) { |
| 265 |
fprintf(stderr, "%s\n", error); |
| 266 |
} |
| 267 |
} |
| 268 |
|
| 269 |
*(void **) (&XIGrabKeycode_dylibloader_wrapper_xinput2) = dlsym(handle, "XIGrabKeycode"); |
| 270 |
if (verbose) { |
| 271 |
error = dlerror(); |
| 272 |
if (error != NULL) { |
| 273 |
fprintf(stderr, "%s\n", error); |
| 274 |
} |
| 275 |
} |
| 276 |
|
| 277 |
*(void **) (&XIGrabEnter_dylibloader_wrapper_xinput2) = dlsym(handle, "XIGrabEnter"); |
| 278 |
if (verbose) { |
| 279 |
error = dlerror(); |
| 280 |
if (error != NULL) { |
| 281 |
fprintf(stderr, "%s\n", error); |
| 282 |
} |
| 283 |
} |
| 284 |
|
| 285 |
*(void **) (&XIGrabFocusIn_dylibloader_wrapper_xinput2) = dlsym(handle, "XIGrabFocusIn"); |
| 286 |
if (verbose) { |
| 287 |
error = dlerror(); |
| 288 |
if (error != NULL) { |
| 289 |
fprintf(stderr, "%s\n", error); |
| 290 |
} |
| 291 |
} |
| 292 |
|
| 293 |
*(void **) (&XIGrabTouchBegin_dylibloader_wrapper_xinput2) = dlsym(handle, "XIGrabTouchBegin"); |
| 294 |
if (verbose) { |
| 295 |
error = dlerror(); |
| 296 |
if (error != NULL) { |
| 297 |
fprintf(stderr, "%s\n", error); |
| 298 |
} |
| 299 |
} |
| 300 |
|
| 301 |
*(void **) (&XIUngrabButton_dylibloader_wrapper_xinput2) = dlsym(handle, "XIUngrabButton"); |
| 302 |
if (verbose) { |
| 303 |
error = dlerror(); |
| 304 |
if (error != NULL) { |
| 305 |
fprintf(stderr, "%s\n", error); |
| 306 |
} |
| 307 |
} |
| 308 |
|
| 309 |
*(void **) (&XIUngrabKeycode_dylibloader_wrapper_xinput2) = dlsym(handle, "XIUngrabKeycode"); |
| 310 |
if (verbose) { |
| 311 |
error = dlerror(); |
| 312 |
if (error != NULL) { |
| 313 |
fprintf(stderr, "%s\n", error); |
| 314 |
} |
| 315 |
} |
| 316 |
|
| 317 |
*(void **) (&XIUngrabEnter_dylibloader_wrapper_xinput2) = dlsym(handle, "XIUngrabEnter"); |
| 318 |
if (verbose) { |
| 319 |
error = dlerror(); |
| 320 |
if (error != NULL) { |
| 321 |
fprintf(stderr, "%s\n", error); |
| 322 |
} |
| 323 |
} |
| 324 |
|
| 325 |
*(void **) (&XIUngrabFocusIn_dylibloader_wrapper_xinput2) = dlsym(handle, "XIUngrabFocusIn"); |
| 326 |
if (verbose) { |
| 327 |
error = dlerror(); |
| 328 |
if (error != NULL) { |
| 329 |
fprintf(stderr, "%s\n", error); |
| 330 |
} |
| 331 |
} |
| 332 |
|
| 333 |
*(void **) (&XIUngrabTouchBegin_dylibloader_wrapper_xinput2) = dlsym(handle, "XIUngrabTouchBegin"); |
| 334 |
if (verbose) { |
| 335 |
error = dlerror(); |
| 336 |
if (error != NULL) { |
| 337 |
fprintf(stderr, "%s\n", error); |
| 338 |
} |
| 339 |
} |
| 340 |
|
| 341 |
*(void **) (&XIListProperties_dylibloader_wrapper_xinput2) = dlsym(handle, "XIListProperties"); |
| 342 |
if (verbose) { |
| 343 |
error = dlerror(); |
| 344 |
if (error != NULL) { |
| 345 |
fprintf(stderr, "%s\n", error); |
| 346 |
} |
| 347 |
} |
| 348 |
|
| 349 |
*(void **) (&XIChangeProperty_dylibloader_wrapper_xinput2) = dlsym(handle, "XIChangeProperty"); |
| 350 |
if (verbose) { |
| 351 |
error = dlerror(); |
| 352 |
if (error != NULL) { |
| 353 |
fprintf(stderr, "%s\n", error); |
| 354 |
} |
| 355 |
} |
| 356 |
|
| 357 |
*(void **) (&XIDeleteProperty_dylibloader_wrapper_xinput2) = dlsym(handle, "XIDeleteProperty"); |
| 358 |
if (verbose) { |
| 359 |
error = dlerror(); |
| 360 |
if (error != NULL) { |
| 361 |
fprintf(stderr, "%s\n", error); |
| 362 |
} |
| 363 |
} |
| 364 |
|
| 365 |
*(void **) (&XIGetProperty_dylibloader_wrapper_xinput2) = dlsym(handle, "XIGetProperty"); |
| 366 |
if (verbose) { |
| 367 |
error = dlerror(); |
| 368 |
if (error != NULL) { |
| 369 |
fprintf(stderr, "%s\n", error); |
| 370 |
} |
| 371 |
} |
| 372 |
|
| 373 |
*(void **) (&XIBarrierReleasePointers_dylibloader_wrapper_xinput2) = dlsym(handle, "XIBarrierReleasePointers"); |
| 374 |
if (verbose) { |
| 375 |
error = dlerror(); |
| 376 |
if (error != NULL) { |
| 377 |
fprintf(stderr, "%s\n", error); |
| 378 |
} |
| 379 |
} |
| 380 |
|
| 381 |
*(void **) (&XIBarrierReleasePointer_dylibloader_wrapper_xinput2) = dlsym(handle, "XIBarrierReleasePointer"); |
| 382 |
if (verbose) { |
| 383 |
error = dlerror(); |
| 384 |
if (error != NULL) { |
| 385 |
fprintf(stderr, "%s\n", error); |
| 386 |
} |
| 387 |
} |
| 388 |
|
| 389 |
*(void **) (&XIFreeDeviceInfo_dylibloader_wrapper_xinput2) = dlsym(handle, "XIFreeDeviceInfo"); |
| 390 |
if (verbose) { |
| 391 |
error = dlerror(); |
| 392 |
if (error != NULL) { |
| 393 |
fprintf(stderr, "%s\n", error); |
| 394 |
} |
| 395 |
} |
| 396 |
return 0; |
| 397 |
} |