From a5720df10fa0a40e1438e18b254925361bb623b8 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 5 Jul 2024 11:55:56 +0200 Subject: Nicer window focus transition for padding handling --- src/capture/xcomposite.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/capture/xcomposite.c b/src/capture/xcomposite.c index 4f89e11..f5d2b2f 100644 --- a/src/capture/xcomposite.c +++ b/src/capture/xcomposite.c @@ -258,10 +258,20 @@ static void gsr_capture_xcomposite_tick(gsr_capture *cap, AVCodecContext *video_ self->window_size.x = max_int(attr.width, 0); self->window_size.y = max_int(attr.height, 0); - self->window_resized = true; window_texture_deinit(&self->window_texture); window_texture_init(&self->window_texture, self->params.egl->x11.dpy, self->window, self->params.egl); // TODO: Do not do the below window_texture_on_resize after this + + self->texture_size.x = 0; + self->texture_size.y = 0; + + self->params.egl->glBindTexture(GL_TEXTURE_2D, window_texture_get_opengl_texture_id(&self->window_texture)); + self->params.egl->glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &self->texture_size.x); + self->params.egl->glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &self->texture_size.y); + self->params.egl->glBindTexture(GL_TEXTURE_2D, 0); + + self->window_resized = false; + self->clear_background = true; gsr_capture_xcomposite_setup_damage(self, self->window); } } -- cgit v1.2.3