From 5500ce377a0a552bfa858232f7086c197d0ab458 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 18 Apr 2025 15:14:31 +0200 Subject: Wayland rendering now works --- src/graphics/backend/glx.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src/graphics/backend/glx.c') 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; } -- cgit v1.2.3-70-g09d2