From 8a82fa688b4ca27bb96900da97dce0fd870d3a65 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 31 Jul 2024 21:01:31 +0200 Subject: More style changes --- gpu-screen-recorder-overlay-daemon/main.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'gpu-screen-recorder-overlay-daemon/main.c') diff --git a/gpu-screen-recorder-overlay-daemon/main.c b/gpu-screen-recorder-overlay-daemon/main.c index 76e1980..7a97c64 100644 --- a/gpu-screen-recorder-overlay-daemon/main.c +++ b/gpu-screen-recorder-overlay-daemon/main.c @@ -199,15 +199,23 @@ int main() { if(xev.type == KeyPress && xev.xkey.keycode == overlay_keycode) { if(overlay_pid != -1) { int status; - if(waitpid(overlay_pid, &status, WNOHANG) == 0) - continue; // GPU Screen Recorder overlay is still running - - overlay_pid = -1; + if(waitpid(overlay_pid, &status, WNOHANG) == 0) { + kill(overlay_pid, SIGINT); + int status; + if(waitpid(overlay_pid, &status, 0) == -1) { + perror("waitpid failed"); + /* Ignore... */ + } + overlay_pid = -1; + continue; + } else { + overlay_pid = -1; + } } - Window window_with_input_focus = get_window_with_input_focus(display); - fprintf(stderr, "window with focus: %ld\n", window_with_input_focus); - if(window_with_input_focus && window_with_input_focus != DefaultRootWindow(display) && overlay_pid == -1) { + //Window window_with_input_focus = get_window_with_input_focus(display); + //fprintf(stderr, "window with focus: %ld\n", window_with_input_focus); + if(/*window_with_input_focus && window_with_input_focus != DefaultRootWindow(display) && */overlay_pid == -1) { fprintf(stderr, "launch overlay\n"); // TODO: window_with_input_focus const char *args[] = { -- cgit v1.2.3