| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
#include <stdint.h> |
| 7 |
|
| 8 |
#define wl_cursor_theme_load wl_cursor_theme_load_dylibloader_orig_wayland_cursor |
| 9 |
#define wl_cursor_theme_destroy wl_cursor_theme_destroy_dylibloader_orig_wayland_cursor |
| 10 |
#define wl_cursor_theme_get_cursor wl_cursor_theme_get_cursor_dylibloader_orig_wayland_cursor |
| 11 |
#define wl_cursor_image_get_buffer wl_cursor_image_get_buffer_dylibloader_orig_wayland_cursor |
| 12 |
#define wl_cursor_frame wl_cursor_frame_dylibloader_orig_wayland_cursor |
| 13 |
#define wl_cursor_frame_and_duration wl_cursor_frame_and_duration_dylibloader_orig_wayland_cursor |
| 14 |
#include "./thirdparty/linuxbsd_headers/wayland/wayland-cursor.h" |
| 15 |
#undef wl_cursor_theme_load |
| 16 |
#undef wl_cursor_theme_destroy |
| 17 |
#undef wl_cursor_theme_get_cursor |
| 18 |
#undef wl_cursor_image_get_buffer |
| 19 |
#undef wl_cursor_frame |
| 20 |
#undef wl_cursor_frame_and_duration |
| 21 |
#include <dlfcn.h> |
| 22 |
#include <stdio.h> |
| 23 |
struct wl_cursor_theme* (*wl_cursor_theme_load_dylibloader_wrapper_wayland_cursor)(const char*, int,struct wl_shm*); |
| 24 |
void (*wl_cursor_theme_destroy_dylibloader_wrapper_wayland_cursor)(struct wl_cursor_theme*); |
| 25 |
struct wl_cursor* (*wl_cursor_theme_get_cursor_dylibloader_wrapper_wayland_cursor)(struct wl_cursor_theme*,const char*); |
| 26 |
struct wl_buffer* (*wl_cursor_image_get_buffer_dylibloader_wrapper_wayland_cursor)(struct wl_cursor_image*); |
| 27 |
int (*wl_cursor_frame_dylibloader_wrapper_wayland_cursor)(struct wl_cursor*, uint32_t); |
| 28 |
int (*wl_cursor_frame_and_duration_dylibloader_wrapper_wayland_cursor)(struct wl_cursor*, uint32_t, uint32_t*); |
| 29 |
int initialize_wayland_cursor(int verbose) { |
| 30 |
void *handle; |
| 31 |
char *error; |
| 32 |
handle = dlopen("libwayland-cursor.so.0", RTLD_LAZY); |
| 33 |
if (!handle) { |
| 34 |
if (verbose) { |
| 35 |
fprintf(stderr, "%s\n", dlerror()); |
| 36 |
} |
| 37 |
return(1); |
| 38 |
} |
| 39 |
dlerror(); |
| 40 |
|
| 41 |
*(void **) (&wl_cursor_theme_load_dylibloader_wrapper_wayland_cursor) = dlsym(handle, "wl_cursor_theme_load"); |
| 42 |
if (verbose) { |
| 43 |
error = dlerror(); |
| 44 |
if (error != NULL) { |
| 45 |
fprintf(stderr, "%s\n", error); |
| 46 |
} |
| 47 |
} |
| 48 |
|
| 49 |
*(void **) (&wl_cursor_theme_destroy_dylibloader_wrapper_wayland_cursor) = dlsym(handle, "wl_cursor_theme_destroy"); |
| 50 |
if (verbose) { |
| 51 |
error = dlerror(); |
| 52 |
if (error != NULL) { |
| 53 |
fprintf(stderr, "%s\n", error); |
| 54 |
} |
| 55 |
} |
| 56 |
|
| 57 |
*(void **) (&wl_cursor_theme_get_cursor_dylibloader_wrapper_wayland_cursor) = dlsym(handle, "wl_cursor_theme_get_cursor"); |
| 58 |
if (verbose) { |
| 59 |
error = dlerror(); |
| 60 |
if (error != NULL) { |
| 61 |
fprintf(stderr, "%s\n", error); |
| 62 |
} |
| 63 |
} |
| 64 |
|
| 65 |
*(void **) (&wl_cursor_image_get_buffer_dylibloader_wrapper_wayland_cursor) = dlsym(handle, "wl_cursor_image_get_buffer"); |
| 66 |
if (verbose) { |
| 67 |
error = dlerror(); |
| 68 |
if (error != NULL) { |
| 69 |
fprintf(stderr, "%s\n", error); |
| 70 |
} |
| 71 |
} |
| 72 |
|
| 73 |
*(void **) (&wl_cursor_frame_dylibloader_wrapper_wayland_cursor) = dlsym(handle, "wl_cursor_frame"); |
| 74 |
if (verbose) { |
| 75 |
error = dlerror(); |
| 76 |
if (error != NULL) { |
| 77 |
fprintf(stderr, "%s\n", error); |
| 78 |
} |
| 79 |
} |
| 80 |
|
| 81 |
*(void **) (&wl_cursor_frame_and_duration_dylibloader_wrapper_wayland_cursor) = dlsym(handle, "wl_cursor_frame_and_duration"); |
| 82 |
if (verbose) { |
| 83 |
error = dlerror(); |
| 84 |
if (error != NULL) { |
| 85 |
fprintf(stderr, "%s\n", error); |
| 86 |
} |
| 87 |
} |
| 88 |
return 0; |
| 89 |
} |