Ignore signals during command execution
Disable signal handlers in wins_prepare_external() and reactivate them in wins_unprepare_external(). Before, it was possible that resizing the window during editor/pager mode resulted in the calcurse main screen appearing on top. Addresses BUG#9. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
parent
7f16e1c1d3
commit
8ae75f3ca7
@ -883,6 +883,8 @@ void recur_apoint_paste_item(void);
|
|||||||
/* sigs.c */
|
/* sigs.c */
|
||||||
void sigs_init(void);
|
void sigs_init(void);
|
||||||
unsigned sigs_set_hdlr(int, void (*)(int));
|
unsigned sigs_set_hdlr(int, void (*)(int));
|
||||||
|
void sigs_ignore(void);
|
||||||
|
void sigs_unignore(void);
|
||||||
|
|
||||||
/* todo.c */
|
/* todo.c */
|
||||||
extern llist_t todolist;
|
extern llist_t todolist;
|
||||||
|
14
src/sigs.c
14
src/sigs.c
@ -108,3 +108,17 @@ void sigs_init()
|
|||||||
|| !sigs_set_hdlr(SIGINT, SIG_IGN))
|
|| !sigs_set_hdlr(SIGINT, SIG_IGN))
|
||||||
exit_calcurse(1);
|
exit_calcurse(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Ignore SIGWINCH and SIGTERM signals. */
|
||||||
|
void sigs_ignore(void)
|
||||||
|
{
|
||||||
|
sigs_set_hdlr(SIGWINCH, SIG_IGN);
|
||||||
|
sigs_set_hdlr(SIGTERM, SIG_IGN);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* No longer ignore SIGWINCH and SIGTERM signals. */
|
||||||
|
void sigs_unignore(void)
|
||||||
|
{
|
||||||
|
sigs_set_hdlr(SIGWINCH, generic_hdlr);
|
||||||
|
sigs_set_hdlr(SIGTERM, generic_hdlr);
|
||||||
|
}
|
||||||
|
@ -591,16 +591,20 @@ void wins_prepare_external(void)
|
|||||||
clear();
|
clear();
|
||||||
wins_refresh();
|
wins_refresh();
|
||||||
endwin();
|
endwin();
|
||||||
|
sigs_ignore();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Restore windows when returning from an external command. */
|
/* Restore windows when returning from an external command. */
|
||||||
void wins_unprepare_external(void)
|
void wins_unprepare_external(void)
|
||||||
{
|
{
|
||||||
|
sigs_unignore();
|
||||||
reset_prog_mode();
|
reset_prog_mode();
|
||||||
clearok(curscr, TRUE);
|
clearok(curscr, TRUE);
|
||||||
curs_set(0);
|
curs_set(0);
|
||||||
ui_mode = UI_CURSES;
|
ui_mode = UI_CURSES;
|
||||||
wins_refresh();
|
wins_refresh();
|
||||||
|
wins_reinit();
|
||||||
|
wins_update(FLAG_ALL);
|
||||||
if (notify_bar())
|
if (notify_bar())
|
||||||
notify_start_main_thread();
|
notify_start_main_thread();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user