aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index c8b22df5f..6f662f53c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -150,6 +150,31 @@ sigstop(void)
kill(0, SIGSTOP); /* issue SIGSTOP */
}
+static guint timer_sigwinch_id;
+
+static gboolean
+timer_sigwinch(mpd_unused gpointer data)
+{
+ /* the following causes the screen to flicker. There might be
+ better solutions, but I believe it isn't all that
+ important. */
+
+ endwin();
+ refresh();
+ screen_resize();
+
+ return FALSE;
+}
+
+static void
+catch_sigwinch(mpd_unused int sig)
+{
+ if (timer_sigwinch_id != 0)
+ g_source_remove(timer_sigwinch_id);
+
+ timer_sigwinch_id = g_timeout_add(100, timer_sigwinch, NULL);
+}
+
#ifndef NDEBUG
void
D(const char *format, ...)
@@ -383,6 +408,14 @@ main(int argc, const char *argv[])
exit(EXIT_FAILURE);
}
+ /* setup SIGWINCH */
+
+ act.sa_handler = catch_sigwinch;
+ if (sigaction(SIGWINCH, &act, NULL) < 0) {
+ perror("sigaction(SIGWINCH)");
+ exit(EXIT_FAILURE);
+ }
+
ncurses_init();
lyrics_init();