Removed global variable slow_tty

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
Slava Zanko 2011-09-06 18:24:18 +03:00 committed by Andrew Borodin
parent 9d9935d290
commit bfbe9b94ae
12 changed files with 20 additions and 40 deletions

View File

@ -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 =

View File

@ -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

View File

@ -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);

View File

@ -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;

View File

@ -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

View File

@ -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. */

View File

@ -34,7 +34,7 @@
#include <signal.h>
#include <stdarg.h>
#include <stdlib.h>
#include <unistd.h> /* exit() */
#include <unistd.h> /* exit() */
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
@ -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)
{

View File

@ -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);

View File

@ -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);

View File

@ -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
},

View File

@ -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;
}

View File

@ -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 ();