core: query glx extension in session_init

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2020-03-31 06:07:09 +01:00
parent fd4d43aa02
commit 2372127c0f
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
3 changed files with 12 additions and 9 deletions

View File

@ -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;
}

View File

@ -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

View File

@ -19,6 +19,7 @@
#include <string.h>
#include <xcb/composite.h>
#include <xcb/damage.h>
#include <xcb/glx.h>
#include <xcb/present.h>
#include <xcb/randr.h>
#include <xcb/render.h>
@ -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;