From 1096c2d29f93d72aa701f88f09df9ce9e6177de7 Mon Sep 17 00:00:00 2001 From: Frederic Culot Date: Wed, 15 Aug 2007 15:30:17 +0000 Subject: handling of SIGWINCH added --- src/sigs.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/sigs.c') diff --git a/src/sigs.c b/src/sigs.c index 4928744..e498b24 100755 --- a/src/sigs.c +++ b/src/sigs.c @@ -1,4 +1,4 @@ -/* $Id: sigs.c,v 1.2 2007/07/28 13:11:42 culot Exp $ */ +/* $Id: sigs.c,v 1.3 2007/08/15 15:30:17 culot Exp $ */ /* * Calcurse - text-based organizer @@ -31,12 +31,13 @@ #include "i18n.h" #include "vars.h" +#include "wins.h" /* * General signal handling routine. * Catch return values from children (user-defined notification commands). * This is needed to avoid zombie processes running on system. - * Also catch CTRL-C (SIGINT) to exit properly. + * Also catch CTRL-C (SIGINT), and SIGWINCH to resize screen automatically. */ static void signal_handler(int sig) @@ -46,6 +47,9 @@ signal_handler(int sig) while (waitpid(WAIT_MYPGRP, NULL, WNOHANG) > 0) ; break; + case SIGWINCH: + wins_reset(); + break; } } @@ -61,6 +65,14 @@ sigs_init(struct sigaction *sa) exit(EXIT_FAILURE); } + sa->sa_handler = signal_handler; + sa->sa_flags = 0; + sigemptyset(&sa->sa_mask); + if (sigaction(SIGWINCH, sa, NULL) != 0) { + perror("sigaction"); + exit(EXIT_FAILURE); + } + sa->sa_handler = SIG_IGN; sa->sa_flags = 0; sigemptyset(&(sa->sa_mask)); -- cgit v1.2.3