From a83e7699e75cad515019aa1ad5f7d59ee236a918 Mon Sep 17 00:00:00 2001 From: Axel Wagner Date: Wed, 25 Aug 2010 18:31:03 +0200 Subject: [PATCH] Send the child SIGSTOPs and SIGCONTs --- i3bar/include/child.h | 12 ++++++++++++ i3bar/src/child.c | 22 +++++++++++++++++++++- i3bar/src/xcb.c | 3 +++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/i3bar/include/child.h b/i3bar/include/child.h index 0405816d..69cfc576 100644 --- a/i3bar/include/child.h +++ b/i3bar/include/child.h @@ -26,4 +26,16 @@ void start_child(char *command); */ void kill_child(); +/* + * Sends a SIGSTOP to the child-process (if existent) + * + */ +void stop_child(); + +/* + * Sends a SIGCONT to the child-process (if existent) + * + */ +void cont_child(); + #endif diff --git a/i3bar/src/child.c b/i3bar/src/child.c index 2b0fb780..4be5d12d 100644 --- a/i3bar/src/child.c +++ b/i3bar/src/child.c @@ -176,7 +176,7 @@ void start_child(char *command) { } /* - * kill()s the child-prozess (if existend) and closes and + * kill()s the child-process (if existent) and closes and * free()s the stdin- and sigchild-watchers * */ @@ -186,3 +186,23 @@ void kill_child() { } cleanup(); } + +/* + * Sends a SIGSTOP to the child-process (if existent) + * + */ +void stop_child() { + if (child_pid != 0) { + kill(child_pid, SIGSTOP); + } +} + +/* + * Sends a SIGCONT to the child-process (if existent) + * + */ +void cont_child() { + if (child_pid != 0) { + kill(child_pid, SIGCONT); + } +} diff --git a/i3bar/src/xcb.c b/i3bar/src/xcb.c index 9494b389..f5a50686 100644 --- a/i3bar/src/xcb.c +++ b/i3bar/src/xcb.c @@ -76,6 +76,7 @@ void hide_bars() { SLIST_FOREACH(walk, outputs, slist) { xcb_unmap_window(xcb_connection, walk->bar); } + stop_child(); } /* @@ -89,6 +90,8 @@ void unhide_bars() { uint32_t mask; uint32_t values[4]; + cont_child(); + SLIST_FOREACH(walk, outputs, slist) { if (walk->bar == XCB_NONE) { continue; -- 2.39.5