Ejemplo n.º 1
0
Archivo: getch2.c Proyecto: maletor/mpv
void getch2_disable(void){
    if (!getch2_enabled)
        return;

    // restore signals
    setsigaction(SIGCONT, SIG_DFL, 0, false);
    setsigaction(SIGTSTP, SIG_DFL, 0, false);
    setsigaction(SIGINT, SIG_DFL, 0, false);
    setsigaction(SIGTTIN, SIG_DFL, 0, false);

    do_deactivate_getch2();

    getch2_enabled = 0;
}
Ejemplo n.º 2
0
Archivo: getch2.c Proyecto: maletor/mpv
void getch2_enable(void){
    if (getch2_enabled)
        return;

    // handlers to fix terminal settings
    setsigaction(SIGCONT, continue_sighandler, 0, true);
    setsigaction(SIGTSTP, stop_sighandler, SA_RESETHAND, false);
    setsigaction(SIGINT, quit_request_sighandler, SA_RESETHAND, false);
    setsigaction(SIGTTIN, SIG_IGN, 0, true);

    do_activate_getch2();

    getch2_enabled = 1;
}
Ejemplo n.º 3
0
static void continue_sighandler(int signum)
{
    // SA_RESETHAND has reset SIGTSTP, so we need to restore it here
    setsigaction(SIGTSTP, stop_sighandler, SA_RESETHAND, false);

    getch2_poll();
}