aboutsummaryrefslogtreecommitdiff
path: root/include/signal-handler.h
diff options
context:
space:
mode:
authorPhilip Wittamore <philip@wittamore.com>2025-06-08 22:00:43 +0200
committerPhilip Wittamore <philip@wittamore.com>2025-06-08 22:00:43 +0200
commit81757c235ff8e112b4baabdd1ff23409426e9c98 (patch)
treeef213566ac3c17bf3d7795b0597f254791bd219e /include/signal-handler.h
downloaddwmblocks-async-81757c235ff8e112b4baabdd1ff23409426e9c98.tar.gz
dwmblocks-async-81757c235ff8e112b4baabdd1ff23409426e9c98.tar.bz2
dwmblocks-async-81757c235ff8e112b4baabdd1ff23409426e9c98.zip
update
Diffstat (limited to 'include/signal-handler.h')
-rw-r--r--include/signal-handler.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/include/signal-handler.h b/include/signal-handler.h
new file mode 100644
index 0000000..da2d471
--- /dev/null
+++ b/include/signal-handler.h
@@ -0,0 +1,33 @@
+#ifndef SIGNAL_HANDLER_H
+#define SIGNAL_HANDLER_H
+
+#include <signal.h>
+
+#include "block.h"
+#include "timer.h"
+
+typedef sigset_t signal_set;
+typedef int (*signal_refresh_callback)(block* const blocks,
+ const unsigned short block_count);
+typedef int (*signal_timer_callback)(block* const blocks,
+ const unsigned short block_code,
+ timer* const timer);
+
+typedef struct {
+ int fd;
+ const signal_refresh_callback refresh_callback;
+ const signal_timer_callback timer_callback;
+
+ block* const blocks;
+ const unsigned short block_count;
+} signal_handler;
+
+signal_handler signal_handler_new(
+ block* const blocks, const unsigned short block_count,
+ const signal_refresh_callback refresh_callback,
+ const signal_timer_callback timer_callback);
+int signal_handler_init(signal_handler* const handler);
+int signal_handler_deinit(signal_handler* const handler);
+int signal_handler_process(signal_handler* const handler, timer* const timer);
+
+#endif // SIGNAL_HANDLER_H