Handling of SIGWINCH improved

This commit is contained in:
Frederic Culot 2007-10-07 17:13:10 +00:00
parent 5e62e11e23
commit f3e8775cab
2 changed files with 24 additions and 12 deletions

View File

@ -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 * Calcurse - text-based organizer
@ -62,6 +62,7 @@ main(int argc, char **argv)
int sav_hilt_tod = 0; int sav_hilt_tod = 0;
struct sigaction sigact; struct sigaction sigact;
bool do_storage = false; bool do_storage = false;
bool do_update = true;
bool day_changed = false; bool day_changed = false;
char *no_color_support = char *no_color_support =
_("Sorry, colors are not supported by your terminal\n" _("Sorry, colors are not supported by your terminal\n"
@ -158,10 +159,21 @@ main(int argc, char **argv)
/* User input */ /* User input */
for (;;) { for (;;) {
/* Get user input. */ do_update = true;
ch = wgetch(swin); ch = wgetch(swin);
switch (ch) { 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. */ case 9: /* The TAB key was hit. */
reset_status_page(); reset_status_page();
/* Save previously highlighted event. */ /* Save previously highlighted event. */
@ -199,11 +211,6 @@ main(int argc, char **argv)
} }
break; break;
case CTRL('R'):
wins_reset();
do_storage = true;
break;
case 'O': case 'O':
case 'o': case 'o':
other_status_page(wins_slctd()); other_status_page(wins_slctd());
@ -447,6 +454,10 @@ main(int argc, char **argv)
} else } else
exit_calcurse(EXIT_SUCCESS); exit_calcurse(EXIT_SUCCESS);
break; break;
default:
do_update = false;
break;
} }
if (do_storage) { if (do_storage) {
@ -461,7 +472,7 @@ main(int argc, char **argv)
apoint_hilt_set(1); apoint_hilt_set(1);
} }
} }
if (do_update)
wins_update(); wins_update();
} }
} }

View File

@ -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 * Calcurse - text-based organizer
@ -48,7 +48,8 @@ signal_handler(int sig)
; ;
break; break;
case SIGWINCH: case SIGWINCH:
wins_reset(); clearok(curscr, TRUE);
ungetch(KEY_RESIZE);
break; break;
} }
} }