diff --git a/src/gl/inject_glx.cpp b/src/gl/inject_glx.cpp index 1b3f7e7..b18233c 100644 --- a/src/gl/inject_glx.cpp +++ b/src/gl/inject_glx.cpp @@ -1,3 +1,4 @@ +#include #include #include #include @@ -270,6 +271,30 @@ void* get_glx_proc_address(const char* name) { return func; } +Status XGetGeometry( + Display *display, + Drawable d, + Window *root, + int *x, + int *y, + unsigned int *width, + unsigned int *height, + unsigned int *border_width, + unsigned int *depth +) +{ + static decltype(&::XGetGeometry) pfnXGetGeometry = nullptr; + if (!pfnXGetGeometry) { + void *handle = real_dlopen("libX11.so.6", RTLD_LAZY); + if (!handle) + std::cerr << "MANGOHUD: couldn't find libX11.so.6" << std::endl; + pfnXGetGeometry = reinterpret_cast( + real_dlsym(handle, "XGetGeometry")); + } + + return pfnXGetGeometry(display, d, root, x, y, width, height, border_width, depth); +} + EXPORT_C_(void *) glXCreateContext(void *dpy, void *vis, void *shareList, int direct) { gl.Load();