aboutsummaryrefslogtreecommitdiff
path: root/mainloop.c
diff options
context:
space:
mode:
Diffstat (limited to 'mainloop.c')
-rw-r--r--mainloop.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/mainloop.c b/mainloop.c
index 56129aa..04d0ac9 100644
--- a/mainloop.c
+++ b/mainloop.c
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
+#include <signal.h>
#include <sys/epoll.h>
#include "mainloop.h"
@@ -56,6 +57,17 @@ int mainloop(unsigned int timeout)
return -1;
}
+ /*
+ * A timeout occured. Let's send to ourself a SIGWINCH
+ * so the window get refreshed automatically. No need
+ * to use exported functions and this code stay self
+ * contained.
+ */
+ if (!nfds) {
+ kill(getpid(), SIGWINCH);
+ continue;
+ }
+
for (i = 0; i < nfds; i++) {
md = events[i].data.ptr;