From f3e8775cabbd82d006a17f860c49dc2cffeb80f1 Mon Sep 17 00:00:00 2001 From: Frederic Culot Date: Sun, 7 Oct 2007 17:13:10 +0000 Subject: Handling of SIGWINCH improved --- src/calcurse.c | 31 +++++++++++++++++++++---------- src/sigs.c | 5 +++-- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/src/calcurse.c b/src/calcurse.c index f11215c..b8ad8b4 100755 --- a/src/calcurse.c +++ b/src/calcurse.c @@ -1,4 +1,4 @@ -/* $calcurse: calcurse.c,v 1.55 2007/08/19 13:15:55 culot Exp $ */ +/* $calcurse: calcurse.c,v 1.56 2007/10/07 17:13:10 culot Exp $ */ /* * Calcurse - text-based organizer @@ -62,6 +62,7 @@ main(int argc, char **argv) int sav_hilt_tod = 0; struct sigaction sigact; bool do_storage = false; + bool do_update = true; bool day_changed = false; char *no_color_support = _("Sorry, colors are not supported by your terminal\n" @@ -157,11 +158,22 @@ main(int argc, char **argv) /* User input */ for (;;) { - - /* Get user input. */ + + do_update = true; ch = wgetch(swin); + switch (ch) { + case ERR: + do_update = false; + break; + + case CTRL('R'): + case KEY_RESIZE: + do_update = false; + wins_reset(); + break; + case 9: /* The TAB key was hit. */ reset_status_page(); /* Save previously highlighted event. */ @@ -199,11 +211,6 @@ main(int argc, char **argv) } break; - case CTRL('R'): - wins_reset(); - do_storage = true; - break; - case 'O': case 'o': other_status_page(wins_slctd()); @@ -447,6 +454,10 @@ main(int argc, char **argv) } else exit_calcurse(EXIT_SUCCESS); break; + + default: + do_update = false; + break; } if (do_storage) { @@ -461,7 +472,7 @@ main(int argc, char **argv) apoint_hilt_set(1); } } - - wins_update(); + if (do_update) + wins_update(); } } diff --git a/src/sigs.c b/src/sigs.c index e498b24..261da4e 100755 --- a/src/sigs.c +++ b/src/sigs.c @@ -1,4 +1,4 @@ -/* $Id: sigs.c,v 1.3 2007/08/15 15:30:17 culot Exp $ */ +/* $Id: sigs.c,v 1.4 2007/10/07 17:13:10 culot Exp $ */ /* * Calcurse - text-based organizer @@ -48,7 +48,8 @@ signal_handler(int sig) ; break; case SIGWINCH: - wins_reset(); + clearok(curscr, TRUE); + ungetch(KEY_RESIZE); break; } } -- cgit v1.2.3