aboutsummaryrefslogtreecommitdiff
path: root/src/graphics/backend/glx.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/graphics/backend/glx.c')
-rw-r--r--src/graphics/backend/glx.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/graphics/backend/glx.c b/src/graphics/backend/glx.c
index 548b0a0..70836e3 100644
--- a/src/graphics/backend/glx.c
+++ b/src/graphics/backend/glx.c
@@ -23,7 +23,7 @@ static bool xvisual_match_alpha(Display *dpy, XVisualInfo *visual_info, bool alp
return (alpha && pict_format->direct.alphaMask > 0) || (!alpha && pict_format->direct.alphaMask == 0);
}
-static bool mgl_graphics_glx_context_choose(mgl_graphics_glx *self, mgl_context *context, bool alpha) {
+static bool mgl_graphics_glx_choose_config(mgl_graphics_glx *self, mgl_context *context, bool alpha) {
const int attr[] = {
GLX_RENDER_TYPE, GLX_RGBA_BIT,
GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
@@ -58,14 +58,13 @@ static bool mgl_graphics_glx_context_choose(mgl_graphics_glx *self, mgl_context
}
}
- if(!self->visual_info) {
- if(self->fbconfigs) {
- XFree(self->fbconfigs);
- self->fbconfigs = NULL;
- }
- self->fbconfig = NULL;
+ if(!self->fbconfig) {
+ fprintf(stderr, "mgl error: mgl_graphics_glx_choose_config: no appropriate glx config found\n");
+ return false;
+ }
- fprintf(stderr, "mgl error: no appropriate visual found\n");
+ if(!self->visual_info) {
+ fprintf(stderr, "mgl error: mgl_graphics_glx_choose_config: no appropriate visual found\n");
return false;
}
@@ -129,7 +128,7 @@ bool mgl_graphics_glx_init(mgl_graphics *self) {
self->impl = impl;
mgl_context *context = mgl_get_context();
- if(!mgl_graphics_glx_context_choose(impl, context, self->alpha)) {
+ if(!mgl_graphics_glx_choose_config(impl, context, self->alpha)) {
mgl_graphics_glx_deinit(self);
return false;
}