mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 12:56:51 +03:00
Ticket #3697: (tty_init): unify curses initialization
...for various curses implementations. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
4f4df7d323
commit
4d46a10862
@ -179,6 +179,8 @@ mc_tty_normalize_lines_char (const char *ch)
|
|||||||
void
|
void
|
||||||
tty_init (gboolean mouse_enable, gboolean is_xterm)
|
tty_init (gboolean mouse_enable, gboolean is_xterm)
|
||||||
{
|
{
|
||||||
|
struct termios mode;
|
||||||
|
|
||||||
initscr ();
|
initscr ();
|
||||||
|
|
||||||
#ifdef HAVE_ESCDELAY
|
#ifdef HAVE_ESCDELAY
|
||||||
@ -194,25 +196,15 @@ tty_init (gboolean mouse_enable, gboolean is_xterm)
|
|||||||
ESCDELAY = 200;
|
ESCDELAY = 200;
|
||||||
#endif /* HAVE_ESCDELAY */
|
#endif /* HAVE_ESCDELAY */
|
||||||
|
|
||||||
#ifdef NCURSES_VERSION
|
tcgetattr (STDIN_FILENO, &mode);
|
||||||
/* use Ctrl-g to generate SIGINT */
|
/* use Ctrl-g to generate SIGINT */
|
||||||
cur_term->Nttyb.c_cc[VINTR] = CTRL ('g'); /* ^g */
|
mode.c_cc[VINTR] = CTRL ('g'); /* ^g */
|
||||||
/* disable SIGQUIT to allow use Ctrl-\ key */
|
/* disable SIGQUIT to allow use Ctrl-\ key */
|
||||||
cur_term->Nttyb.c_cc[VQUIT] = NULL_VALUE;
|
mode.c_cc[VQUIT] = NULL_VALUE;
|
||||||
tcsetattr (cur_term->Filedes, TCSANOW, &cur_term->Nttyb);
|
tcsetattr (STDIN_FILENO, TCSANOW, &mode);
|
||||||
#else
|
|
||||||
/* other curses implementation (bsd curses, ...) */
|
|
||||||
{
|
|
||||||
struct termios mode;
|
|
||||||
|
|
||||||
tcgetattr (STDIN_FILENO, &mode);
|
/* curses remembers the "in-program" modes after this call */
|
||||||
/* use Ctrl-g to generate SIGINT */
|
def_prog_mode ();
|
||||||
mode.c_cc[VINTR] = CTRL ('g'); /* ^g */
|
|
||||||
/* disable SIGQUIT to allow use Ctrl-\ key */
|
|
||||||
mode.c_cc[VQUIT] = NULL_VALUE;
|
|
||||||
tcsetattr (STDIN_FILENO, TCSANOW, &mode);
|
|
||||||
}
|
|
||||||
#endif /* NCURSES_VERSION */
|
|
||||||
|
|
||||||
tty_start_interrupt_key ();
|
tty_start_interrupt_key ();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user