Reorganization of TTY raw/noraw mode setting functions.

This commit is contained in:
Andrew Borodin 2009-05-19 20:12:29 +04:00
parent fb51cb8241
commit d91122a172
8 changed files with 27 additions and 27 deletions

View File

@ -51,7 +51,7 @@ edition_post_exec (void)
flushinp (); flushinp ();
keypad (stdscr, TRUE); keypad (stdscr, TRUE);
mc_raw_mode (); tty_raw_mode ();
channels_up (); channels_up ();
enable_mouse (); enable_mouse ();
if (alternate_plus_minus) if (alternate_plus_minus)
@ -144,7 +144,7 @@ do_execute (const char *shell, const char *command, int flags)
) { ) {
printf (_("Press any key to continue...")); printf (_("Press any key to continue..."));
fflush (stdout); fflush (stdout);
mc_raw_mode (); tty_raw_mode ();
get_key_code (0); get_key_code (0);
printf ("\r\n"); printf ("\r\n");
fflush (stdout); fflush (stdout);
@ -231,7 +231,7 @@ toggle_panels (void)
numeric_keypad_mode (); numeric_keypad_mode ();
#ifndef HAVE_SLANG #ifndef HAVE_SLANG
/* With slang we don't want any of this, since there /* With slang we don't want any of this, since there
* is no mc_raw_mode supported * is no tty_raw_mode supported
*/ */
reset_shell_mode (); reset_shell_mode ();
noecho (); noecho ();
@ -239,7 +239,7 @@ toggle_panels (void)
keypad (stdscr, FALSE); keypad (stdscr, FALSE);
endwin (); endwin ();
do_exit_ca_mode (); do_exit_ca_mode ();
mc_raw_mode (); tty_raw_mode ();
if (console_flag) if (console_flag)
handle_console (CONSOLE_RESTORE); handle_console (CONSOLE_RESTORE);

View File

@ -52,7 +52,6 @@
#include "../src/tty/color.h" #include "../src/tty/color.h"
#include "../src/tty/key.h" #include "../src/tty/key.h"
#include "../src/tty/mouse.h" #include "../src/tty/mouse.h"
#include "../src/tty/win.h"
#include "dialog.h" #include "dialog.h"
#include "widget.h" #include "widget.h"
@ -582,7 +581,7 @@ done_screen ()
if (!(quit & SUBSHELL_EXIT)) if (!(quit & SUBSHELL_EXIT))
clr_scr (); clr_scr ();
reset_shell_mode (); reset_shell_mode ();
mc_noraw_mode (); tty_noraw_mode ();
keypad (stdscr, FALSE); keypad (stdscr, FALSE);
tty_colors_done (); tty_colors_done ();
} }
@ -723,7 +722,7 @@ change_screen_size (void)
#if defined TIOCGWINSZ #if defined TIOCGWINSZ
#ifndef NCURSES_VERSION #ifndef NCURSES_VERSION
mc_noraw_mode (); tty_noraw_mode ();
endwin (); endwin ();
#endif #endif
low_level_change_screen_size (); low_level_change_screen_size ();

View File

@ -79,7 +79,7 @@ init_curses (void)
#endif /* HAVE_ESCDELAY */ #endif /* HAVE_ESCDELAY */
do_enter_ca_mode (); do_enter_ca_mode ();
mc_raw_mode (); raw ();
noecho (); noecho ();
keypad (stdscr, TRUE); keypad (stdscr, TRUE);
nodelay (stdscr, FALSE); nodelay (stdscr, FALSE);
@ -92,6 +92,18 @@ init_curses (void)
} }
} }
void
tty_raw_mode (void)
{
raw ();
}
void
tty_noraw_mode (void)
{
noraw ();
}
void void
tty_gotoyx (int y, int x) tty_gotoyx (int y, int x)
{ {

View File

@ -269,11 +269,16 @@ init_slang (void)
} }
void void
slang_set_raw_mode (void) tty_raw_mode (void)
{ {
tcsetattr (SLang_TT_Read_FD, TCSANOW, &new_mode); tcsetattr (SLang_TT_Read_FD, TCSANOW, &new_mode);
} }
void
tty_noraw_mode (void)
{
}
/* Done each time we come back from done mode */ /* Done each time we come back from done mode */
void void
slang_prog_mode (void) slang_prog_mode (void)

View File

@ -37,11 +37,7 @@ enum {
# define FALSE 0 # define FALSE 0
#endif #endif
void slang_set_raw_mode (void);
#define doupdate() #define doupdate()
#define raw() slang_set_raw_mode ()
#define noraw()
#define nodelay(x, val) set_slang_delay (val) #define nodelay(x, val) set_slang_delay (val)
#define noecho() #define noecho()
#define beep() SLtt_beep () #define beep() SLtt_beep ()

View File

@ -26,6 +26,8 @@ extern void tty_enable_interrupt_key(void);
extern void tty_disable_interrupt_key(void); extern void tty_disable_interrupt_key(void);
extern gboolean tty_got_interrupt(void); extern gboolean tty_got_interrupt(void);
extern void tty_raw_mode (void);
extern void tty_noraw_mode (void);
/* {{{ Output }}} */ /* {{{ Output }}} */

View File

@ -120,17 +120,6 @@ check_movement_keys (int key, int page_size, void *data, movefn backfn,
return MSG_HANDLED; return MSG_HANDLED;
} }
/* Classification routines */
void mc_raw_mode (void)
{
raw ();
}
void mc_noraw_mode (void)
{
noraw ();
}
/* This flag is set by xterm detection routine in function main() */ /* This flag is set by xterm detection routine in function main() */
/* It is used by function view_other_cmd() */ /* It is used by function view_other_cmd() */
int xterm_flag = 0; int xterm_flag = 0;

View File

@ -20,7 +20,4 @@ extern int xterm_flag;
void do_enter_ca_mode (void); void do_enter_ca_mode (void);
void do_exit_ca_mode (void); void do_exit_ca_mode (void);
void mc_raw_mode (void);
void mc_noraw_mode (void);
#endif /* MC_WIN_H */ #endif /* MC_WIN_H */