NCurses: catch SIGINT and send a C-c instead

This commit is contained in:
Maxime Coste 2012-11-08 14:04:41 +01:00
parent 0e5f548f76
commit 68cc07022c

View File

@ -89,6 +89,12 @@ void on_term_resize(int)
EventManager::instance().force_signal(0); EventManager::instance().force_signal(0);
} }
void on_sigint(int)
{
ungetch(CTRL('c'));
EventManager::instance().force_signal(0);
}
NCursesUI::NCursesUI() NCursesUI::NCursesUI()
{ {
//setlocale(LC_CTYPE, ""); //setlocale(LC_CTYPE, "");
@ -111,6 +117,7 @@ NCursesUI::NCursesUI()
assert(signal_ui == nullptr); assert(signal_ui == nullptr);
signal_ui = this; signal_ui = this;
signal(SIGWINCH, on_term_resize); signal(SIGWINCH, on_term_resize);
signal(SIGINT, on_sigint);
} }
NCursesUI::~NCursesUI() NCursesUI::~NCursesUI()