mirror of https://github.com/mpv-player/mpv
terminal: move SIGTTOU signal handler setup code
This comes with a real change in behavior: now the signal handler is set only when the terminal input code is active (e.g. not with --no-consolecontrols), but this should be ok.
This commit is contained in:
parent
25d4ae74f1
commit
833eba5304
|
@ -102,13 +102,6 @@ static void mp_msg_do_init(void){
|
||||||
SetConsoleMode(hSTDERR, cmode);
|
SetConsoleMode(hSTDERR, cmode);
|
||||||
GetConsoleScreenBufferInfo(hSTDOUT, &cinfo);
|
GetConsoleScreenBufferInfo(hSTDOUT, &cinfo);
|
||||||
stdoutAttrs = cinfo.wAttributes;
|
stdoutAttrs = cinfo.wAttributes;
|
||||||
#endif
|
|
||||||
#ifndef __MINGW32__
|
|
||||||
struct sigaction sa;
|
|
||||||
sa.sa_handler = SIG_IGN;
|
|
||||||
sa.sa_flags = 0;
|
|
||||||
sigemptyset(&sa.sa_mask);
|
|
||||||
sigaction(SIGTTOU, &sa, NULL); // just write to stdout if you have to
|
|
||||||
#endif
|
#endif
|
||||||
int i;
|
int i;
|
||||||
char *env = getenv("MPV_VERBOSE");
|
char *env = getenv("MPV_VERBOSE");
|
||||||
|
|
|
@ -554,6 +554,7 @@ void getch2_enable(void){
|
||||||
setsigaction(SIGQUIT, quit_request_sighandler, SA_RESETHAND, false);
|
setsigaction(SIGQUIT, quit_request_sighandler, SA_RESETHAND, false);
|
||||||
setsigaction(SIGTERM, quit_request_sighandler, SA_RESETHAND, false);
|
setsigaction(SIGTERM, quit_request_sighandler, SA_RESETHAND, false);
|
||||||
setsigaction(SIGTTIN, SIG_IGN, 0, true);
|
setsigaction(SIGTTIN, SIG_IGN, 0, true);
|
||||||
|
setsigaction(SIGTTOU, SIG_IGN, 0, true);
|
||||||
|
|
||||||
do_activate_getch2();
|
do_activate_getch2();
|
||||||
|
|
||||||
|
@ -571,6 +572,7 @@ void getch2_disable(void){
|
||||||
setsigaction(SIGQUIT, SIG_DFL, 0, false);
|
setsigaction(SIGQUIT, SIG_DFL, 0, false);
|
||||||
setsigaction(SIGTERM, SIG_DFL, 0, false);
|
setsigaction(SIGTERM, SIG_DFL, 0, false);
|
||||||
setsigaction(SIGTTIN, SIG_DFL, 0, false);
|
setsigaction(SIGTTIN, SIG_DFL, 0, false);
|
||||||
|
setsigaction(SIGTTOU, SIG_DFL, 0, false);
|
||||||
|
|
||||||
do_deactivate_getch2();
|
do_deactivate_getch2();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue