From bfbe9b94ae43aa32d4aa3067d9bd3b341012ef4f Mon Sep 17 00:00:00 2001 From: Slava Zanko Date: Tue, 6 Sep 2011 18:24:18 +0300 Subject: [PATCH] Removed global variable slow_tty Signed-off-by: Slava Zanko --- lib/global.c | 2 +- lib/global.h | 8 +++++--- lib/skin/lines.c | 2 +- lib/tty/tty-internal.h | 3 --- lib/tty/tty-ncurses.c | 6 ++---- lib/tty/tty-slang.c | 6 ++---- lib/tty/tty.c | 15 ++------------- lib/tty/tty.h | 5 +---- lib/widget/listbox.c | 6 +++--- src/args.c | 2 +- src/filemanager/midnight.c | 2 +- src/main.c | 3 +-- 12 files changed, 20 insertions(+), 40 deletions(-) diff --git a/lib/global.c b/lib/global.c index 4d969e6a4..85e30a9eb 100644 --- a/lib/global.c +++ b/lib/global.c @@ -78,7 +78,6 @@ mc_global_t mc_global = { .disable_colors = FALSE, .skin = NULL, .ugly_line_drawing = FALSE, - .slow_terminal = FALSE }, .widget = @@ -106,6 +105,7 @@ mc_global_t mc_global = { .winch_flag = FALSE, .command_line_colors = NULL, .xterm_flag = FALSE, + .slow_terminal = FALSE, }, .vfs = diff --git a/lib/global.h b/lib/global.h index 9c42ad9c7..37184814f 100644 --- a/lib/global.h +++ b/lib/global.h @@ -214,9 +214,6 @@ typedef struct /* If true use +, -, | for line drawing */ gboolean ugly_line_drawing; - /* For slow terminals */ - gboolean slow_terminal; - } args; struct @@ -258,6 +255,11 @@ typedef struct /* This flag is set by xterm detection routine in function main() */ /* It is used by function view_other_cmd() */ gboolean xterm_flag; + + /* For slow terminals */ + /* If true lines are shown by spaces */ + gboolean slow_terminal; + } tty; struct diff --git a/lib/skin/lines.c b/lib/skin/lines.c index 3debef570..75ea29600 100644 --- a/lib/skin/lines.c +++ b/lib/skin/lines.c @@ -96,7 +96,7 @@ mc_skin_lines_load_frm (mc_skin_t * mc_skin, const char *name) void mc_skin_lines_parse_ini_file (mc_skin_t * mc_skin) { - if (mc_global.args.slow_terminal) + if (mc_global.tty.slow_terminal) mc_skin_hardcoded_space_lines (mc_skin); else if (mc_global.args.ugly_line_drawing) mc_skin_hardcoded_ugly_lines (mc_skin); diff --git a/lib/tty/tty-internal.h b/lib/tty/tty-internal.h index 8eccbf586..b0aa69db4 100644 --- a/lib/tty/tty-internal.h +++ b/lib/tty/tty-internal.h @@ -27,9 +27,6 @@ /*** global variables defined in .c file *********************************************************/ -/* If true lines are shown by spaces */ -extern gboolean slow_tty; - /* The mouse is currently: TRUE - enabled, FALSE - disabled */ extern gboolean mouse_enabled; diff --git a/lib/tty/tty-ncurses.c b/lib/tty/tty-ncurses.c index b9706db1d..922fdedfb 100644 --- a/lib/tty/tty-ncurses.c +++ b/lib/tty/tty-ncurses.c @@ -43,7 +43,7 @@ #define WANT_TERM_H #endif -#include "tty-internal.h" /* slow_tty */ +#include "tty-internal.h" /* mc_tty_normalize_from_utf8() */ #include "tty.h" #include "color-internal.h" #include "mouse.h" @@ -165,10 +165,8 @@ mc_tty_normalize_lines_char (const char *ch) /* --------------------------------------------------------------------------------------------- */ void -tty_init (gboolean slow, gboolean mouse_enable, gboolean is_xterm) +tty_init (gboolean mouse_enable, gboolean is_xterm) { - slow_tty = slow; - initscr (); #ifdef HAVE_ESCDELAY diff --git a/lib/tty/tty-slang.c b/lib/tty/tty-slang.c index 59987829c..84447440f 100644 --- a/lib/tty/tty-slang.c +++ b/lib/tty/tty-slang.c @@ -44,7 +44,7 @@ #include "lib/strutil.h" /* str_term_form */ #include "lib/util.h" /* is_printable() */ -#include "tty-internal.h" /* slow_tty */ +#include "tty-internal.h" /* mc_tty_normalize_from_utf8() */ #include "tty.h" #include "color.h" #include "color-slang.h" @@ -271,10 +271,8 @@ mc_tty_normalize_lines_char (const char *str) /* --------------------------------------------------------------------------------------------- */ void -tty_init (gboolean slow, gboolean mouse_enable, gboolean is_xterm) +tty_init (gboolean mouse_enable, gboolean is_xterm) { - slow_tty = slow; - SLtt_Ignore_Beep = 1; SLutf8_enable (-1); /* has to be called first before any of the other functions. */ diff --git a/lib/tty/tty.c b/lib/tty/tty.c index 5e4247c8f..b07b1ac5f 100644 --- a/lib/tty/tty.c +++ b/lib/tty/tty.c @@ -34,7 +34,7 @@ #include #include #include -#include /* exit() */ +#include /* exit() */ #ifdef HAVE_SYS_IOCTL_H #include @@ -45,7 +45,7 @@ #include "tty.h" #include "tty-internal.h" -#include "mouse.h" /* use_mouse_p */ +#include "mouse.h" /* use_mouse_p */ #include "win.h" /*** global variables ****************************************************************************/ @@ -55,9 +55,6 @@ database */ int reset_hp_softkeys = 0; -/* If true lines are drown by spaces */ -gboolean slow_tty = FALSE; - int mc_tty_frm[MC_TTY_FRM_MAX]; /*** file scope macro definitions ****************************************************************/ @@ -110,14 +107,6 @@ tty_check_term (gboolean force_xterm) /* --------------------------------------------------------------------------------------------- */ -extern gboolean -tty_is_slow (void) -{ - return slow_tty; -} - -/* --------------------------------------------------------------------------------------------- */ - extern void tty_start_interrupt_key (void) { diff --git a/lib/tty/tty.h b/lib/tty/tty.h index 97037fc67..9c1bca0ee 100644 --- a/lib/tty/tty.h +++ b/lib/tty/tty.h @@ -76,12 +76,9 @@ extern void tty_beep (void); /* {{{ Input }}} */ extern gboolean tty_check_term (gboolean force_xterm); -extern void tty_init (gboolean slow, gboolean mouse_enable, - gboolean is_xterm); +extern void tty_init (gboolean mouse_enable, gboolean is_xterm); extern void tty_shutdown (void); -extern gboolean tty_is_slow (void); - extern void tty_start_interrupt_key (void); extern void tty_enable_interrupt_key (void); extern void tty_disable_interrupt_key (void); diff --git a/lib/widget/listbox.c b/lib/widget/listbox.c index 16b74da65..da7c36801 100644 --- a/lib/widget/listbox.c +++ b/lib/widget/listbox.c @@ -121,8 +121,8 @@ listbox_draw (WListbox * l, gboolean focused) const gboolean disabled = (((Widget *) l)->options & W_DISABLED) != 0; const int normalc = disabled ? DISABLED_COLOR : h->color[DLG_COLOR_NORMAL]; int selc = - disabled ? DISABLED_COLOR : focused ? h-> - color[DLG_COLOR_HOT_FOCUS] : h->color[DLG_COLOR_FOCUS]; + disabled ? DISABLED_COLOR : focused ? h->color[DLG_COLOR_HOT_FOCUS] : h-> + color[DLG_COLOR_FOCUS]; GList *le; int pos; @@ -523,7 +523,7 @@ listbox_new (int y, int x, int height, int width, gboolean deletable, lcback_fn l->deletable = deletable; l->callback = callback; l->allow_duplicates = TRUE; - l->scrollbar = !tty_is_slow (); + l->scrollbar = !mc_global.tty.slow_terminal; widget_want_hotkey (l->widget, TRUE); widget_want_cursor (l->widget, FALSE); diff --git a/src/args.c b/src/args.c index 41e3881f6..220ad8f2b 100644 --- a/src/args.c +++ b/src/args.c @@ -221,7 +221,7 @@ static const GOptionEntry argument_terminal_table[] = { { "slow", 's', ARGS_TERM_OPTIONS, G_OPTION_ARG_NONE, - &mc_global.args.slow_terminal, + &mc_global.tty.slow_terminal, N_("To run on slow terminals"), NULL }, diff --git a/src/filemanager/midnight.c b/src/filemanager/midnight.c index 5e5645b23..765bc824e 100644 --- a/src/filemanager/midnight.c +++ b/src/filemanager/midnight.c @@ -828,7 +828,7 @@ setup_mc (void) add_select_channel (mc_global.tty.subshell_pty, load_prompt, 0); #endif /* !HAVE_SUBSHELL_SUPPORT */ - if ((tty_baudrate () < 9600) || tty_is_slow ()) + if ((tty_baudrate () < 9600) || mc_global.tty.slow_terminal) verbose = 0; } diff --git a/src/main.c b/src/main.c index 822ec1d80..66e5a3bc2 100644 --- a/src/main.c +++ b/src/main.c @@ -441,8 +441,7 @@ main (int argc, char *argv[]) /* Must be done before init_subshell, to set up the terminal size: */ /* FIXME: Should be removed and LINES and COLS computed on subshell */ - tty_init (mc_global.args.slow_terminal, !mc_args__nomouse, - mc_global.tty.xterm_flag); + tty_init (!mc_args__nomouse, mc_global.tty.xterm_flag); load_setup ();