aboutsummaryrefslogtreecommitdiff
path: root/gpu-screen-recorder-overlay-daemon/main.c
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-07-31 21:01:31 +0200
committerdec05eba <dec05eba@protonmail.com>2024-07-31 21:01:31 +0200
commit8a82fa688b4ca27bb96900da97dce0fd870d3a65 (patch)
tree153e58a35e45215d4e6efa64afc721e30467bce3 /gpu-screen-recorder-overlay-daemon/main.c
parent497217a3e09b577f650aaf503356588515067ca8 (diff)
More style changes
Diffstat (limited to 'gpu-screen-recorder-overlay-daemon/main.c')
-rw-r--r--gpu-screen-recorder-overlay-daemon/main.c22
1 files changed, 15 insertions, 7 deletions
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[] = {