summaryrefslogtreecommitdiff
path: root/dwmblocks.c
diff options
context:
space:
mode:
authortorrinfail <torrinfail@gmail.com>2020-06-11 01:13:49 -0600
committerGitHub <noreply@github.com>2020-06-11 01:13:49 -0600
commit31b9d65b31dfd9af2f38769f11b942eafda28483 (patch)
treedb27605313868f1647f5e5987183d731d92caddb /dwmblocks.c
parent6e0519df3aeba97276d18a8e4bb7d41df675634c (diff)
parent06710ebd054f2658f2b46e7c784eea51d58bb72d (diff)
Merge pull request #8 from markcaudill/master
This merge adds fix for issue #5 which @markcaudill fixed by having all real-time signals handled by a dummy handler if it doesn't have a refresh signal .
Diffstat (limited to 'dwmblocks.c')
-rw-r--r--dwmblocks.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/dwmblocks.c b/dwmblocks.c
index 2f3b774..8668f04 100644
--- a/dwmblocks.c
+++ b/dwmblocks.c
@@ -13,6 +13,7 @@ typedef struct {
unsigned int interval;
unsigned int signal;
} Block;
+void dummysighandler(int num);
void sighandler(int num);
void getcmds(int time);
#ifndef __OpenBSD__
@@ -58,7 +59,7 @@ void getcmds(int time)
{
const Block* current;
for(int i = 0; i < LENGTH(blocks); i++)
- {
+ {
current = blocks + i;
if ((current->interval != 0 && time % current->interval == 0) || time == -1)
getcmd(current,statusbar[i]);
@@ -79,8 +80,12 @@ void getsigcmds(int signal)
void setupsignals()
{
+ /* initialize all real time signals with dummy handler */
+ for(int i = SIGRTMIN; i <= SIGRTMAX; i++)
+ signal(i, dummysighandler);
+
for(int i = 0; i < LENGTH(blocks); i++)
- {
+ {
if (blocks[i].signal > 0)
signal(SIGRTMIN+blocks[i].signal, sighandler);
}
@@ -138,6 +143,14 @@ void statusloop()
}
#ifndef __OpenBSD__
+/* this signal handler should do nothing */
+void dummysighandler(int signum)
+{
+ return;
+}
+#endif
+
+#ifndef __OpenBSD__
void sighandler(int signum)
{
getsigcmds(signum-SIGRTMIN);
@@ -154,7 +167,7 @@ void termhandler(int signum)
int main(int argc, char** argv)
{
for(int i = 0; i < argc; i++)
- {
+ {
if (!strcmp("-d",argv[i]))
delim = argv[++i][0];
else if(!strcmp("-p",argv[i]))