diff options
author | Aviana Cruz | 2023-09-01 04:33:49 +0000 |
---|---|---|
committer | Aviana Cruz | 2023-09-01 05:44:23 +0000 |
commit | 46672eba2415897322c919c6e16d1a26853c0c09 (patch) | |
tree | a7ee52cb6e711315ca90666679f1a50283d7ad6e /wrap.c | |
parent | 1a3c33c3e9c4c0b7c22ececa04ce68408ea26f5d (diff) | |
download | aur-46672eba2415897322c919c6e16d1a26853c0c09.tar.gz |
fix aarch64 build and hack XMapWindow for Wayland
Diffstat (limited to 'wrap.c')
-rw-r--r-- | wrap.c | 25 |
1 files changed, 24 insertions, 1 deletions
@@ -1,13 +1,19 @@ // by https://aur.archlinux.org/account/AvianaCruz +#include <X11/Xlibint.h> +#include <dlfcn.h> #include <openssl/ssl.h> +#include <stdlib.h> #ifdef WRAP_FORCE_SINK_HARDWARE -#include <dlfcn.h> #include <pulse/introspect.h> #include <pulse/subscribe.h> #include <string.h> #endif +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif + #ifdef SSL_get_peer_certificate #undef SSL_get_peer_certificate #endif @@ -16,6 +22,23 @@ X509 *SSL_get_peer_certificate(const SSL *s) { return SSL_get1_peer_certificate(s); } +// temporary hack for Wayland screen sharing crash +typedef int (*wrap_XMapWindow_t)(register Display *dpy, Window w); +static wrap_XMapWindow_t wrap_orig_XMapWindow; + +int XMapWindow(register Display *dpy, Window w) { + const char *env = getenv("XDG_SESSION_TYPE"); + if (env == NULL || strcmp(env, "wayland") != 0) { + if (!wrap_orig_XMapWindow) { + wrap_orig_XMapWindow = dlsym(RTLD_NEXT, "XMapWindow"); + } + + return wrap_orig_XMapWindow(dpy, w); + } + + return 1; +} + #ifdef WRAP_FORCE_SINK_HARDWARE typedef pa_operation *(*wrap_pa_get_sink_by_name_t)(pa_context *c, const char *name, |