diff --git a/src/backend/gl/glx.c b/src/backend/gl/glx.c index 9303a98..ac06619 100644 --- a/src/backend/gl/glx.c +++ b/src/backend/gl/glx.c @@ -45,8 +45,6 @@ struct _glx_data { Display *display; int screen; xcb_window_t target_win; - int glx_event; - int glx_error; GLXContext ctx; }; @@ -246,7 +244,7 @@ static backend_t *glx_init(session_t *ps) { XVisualInfo *pvis = NULL; // Check for GLX extension - if (!glXQueryExtension(ps->dpy, &gd->glx_event, &gd->glx_error)) { + if (!ps->glx_exists) { log_error("No GLX extension."); goto end; } diff --git a/src/opengl.c b/src/opengl.c index 0a80c6d..1e956be 100644 --- a/src/opengl.c +++ b/src/opengl.c @@ -51,12 +51,8 @@ bool glx_init(session_t *ps, bool need_render) { // Check for GLX extension if (!ps->glx_exists) { - if (glXQueryExtension(ps->dpy, &ps->glx_event, &ps->glx_error)) - ps->glx_exists = true; - else { - log_error("No GLX extension."); - goto glx_init_end; - } + log_error("No GLX extension."); + goto glx_init_end; } // Get XVisualInfo diff --git a/src/picom.c b/src/picom.c index 80c3d76..fd84081 100644 --- a/src/picom.c +++ b/src/picom.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -1721,6 +1722,7 @@ static session_t *session_init(int argc, char **argv, Display *dpy, xcb_prefetch_extension_data(ps->c, &xcb_xinerama_id); xcb_prefetch_extension_data(ps->c, &xcb_present_id); xcb_prefetch_extension_data(ps->c, &xcb_sync_id); + xcb_prefetch_extension_data(ps->c, &xcb_glx_id); ext_info = xcb_get_extension_data(ps->c, &xcb_render_id); if (!ext_info || !ext_info->present) { @@ -1776,6 +1778,13 @@ static session_t *session_init(int argc, char **argv, Display *dpy, XCB_XFIXES_MINOR_VERSION) .sequence); + ext_info = xcb_get_extension_data(ps->c, &xcb_glx_id); + if (ext_info && ext_info->present) { + ps->glx_exists = true; + ps->glx_error = ext_info->first_error; + ps->glx_event = ext_info->first_event; + } + // Parse configuration file win_option_mask_t winopt_mask[NUM_WINTYPES] = {{0}}; bool shadow_enabled = false, fading_enable = false, hasneg = false;