From 033638c9a0fa86ae2ad3c3b3483fb001d179b9eb Mon Sep 17 00:00:00 2001 From: WebFreak001 Date: Fri, 12 Jun 2020 23:07:38 +0200 Subject: try to improve capture a little bit I'm not too sure if the pixmap config part actually changes something like this but the API of glXCreatePixmap says it will result in a BadMatch error if the window doesn't have the GLX_WINDOW_BIT. Also adds some XSync calls which help debugging crashes. --- src/window_texture.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/window_texture.c b/src/window_texture.c index d899266..71c584b 100644 --- a/src/window_texture.c +++ b/src/window_texture.c @@ -55,7 +55,7 @@ int window_texture_on_resize(WindowTexture *self) { const int pixmap_config[] = { GLX_BIND_TO_TEXTURE_RGBA_EXT, True, - GLX_DRAWABLE_TYPE, GLX_PIXMAP_BIT, + GLX_DRAWABLE_TYPE, GLX_PIXMAP_BIT | GLX_WINDOW_BIT, GLX_BIND_TO_TEXTURE_TARGETS_EXT, GLX_TEXTURE_2D_BIT_EXT, /*GLX_BIND_TO_MIPMAP_TEXTURE_EXT, True,*/ GLX_DOUBLEBUFFER, False, @@ -76,12 +76,16 @@ int window_texture_on_resize(WindowTexture *self) { if(!configs) return 1; + XSync(self->display, 0); + self->pixmap = XCompositeNameWindowPixmap(self->display, self->window); if(!self->pixmap) { result = 2; goto cleanup; } + XSync(self->display, 0); + self->glx_pixmap = glXCreatePixmap(self->display, configs[0], self->pixmap, pixmap_attribs); if(!self->glx_pixmap) { result = 3; -- cgit v1.2.3