From e49d30048f46a51c766c347e52e9ce24522b6861 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 31 Mar 2022 01:50:06 +0200 Subject: Close screenrecorder when target window is closed --- TODO | 3 ++- src/main.cpp | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/TODO b/TODO index 13d5a9f..e082557 100644 --- a/TODO +++ b/TODO @@ -7,4 +7,5 @@ Load cuda at runtime with dlopen. Track window damages and only update then. That is better for output file size. Remove cuda to cuda copy when using nvFBC if possible. ffmpeg is getting in the way. Getting the texture of a window when using a compositor is an nvidia specific limitation. When gpu-screen-recorder supports other gpus then this can be ignored. -Remove dependency on glfw (and glew?). \ No newline at end of file +Remove dependency on glfw (and glew?). +Quickly changing workspace and back while recording under i3 breaks the screen recorder. The resize is triggered and it fails to recreate texture (fail to get texture size, texture id probably == 0). diff --git a/src/main.cpp b/src/main.cpp index 858755b..21927a3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1405,6 +1405,12 @@ int main(int argc, char **argv) { if (frame_time_overflow >= 0.0) { frame_timer_start = time_now - frame_time_overflow; + if(dpy && src_window_id) { + XWindowAttributes attr; + if(!XGetWindowAttributes(dpy, src_window_id, &attr)) + running = 0; + } + bool frame_captured = true; if(redraw) { redraw = false; -- cgit v1.2.3