From 3e15b5af6450a2c93e3caf289fad3e8cf11ce89d Mon Sep 17 00:00:00 2001 From: Ilia Maslakov Date: Fri, 28 Oct 2011 16:09:44 +0400 Subject: [PATCH] Ticket #86 (disable X11 from command line) added option --no-x, -X for starting mc without X11 support. updated documentation: es, hu, it, en, pl, ru, sr. Signed-off-by: Ilia Maslakov --- doc/man/es/mc.1.in | 3 +++ doc/man/hu/mc.1.in | 3 +++ doc/man/it/mc.1.in | 3 +++ doc/man/mc.1.in | 3 +++ doc/man/pl/mc.1.in | 3 +++ doc/man/ru/mc.1.in | 3 +++ doc/man/sr/mc.1.in | 3 +++ lib/global.c | 1 + lib/global.h | 3 +++ lib/tty/key.c | 2 +- src/args.c | 7 +++++++ 11 files changed, 33 insertions(+), 1 deletion(-) diff --git a/doc/man/es/mc.1.in b/doc/man/es/mc.1.in index 66a4ec54e..d360c9f4e 100644 --- a/doc/man/es/mc.1.in +++ b/doc/man/es/mc.1.in @@ -112,6 +112,9 @@ Muestra la versión del programa. Fuerza el modo xterm. Usado cuando se ejecuta en terminales con características de xterm (dos modos de pantalla, y pueden enviar secuencias de escape de ratón). .TP +.I \-X, \-\-no\-x +Do not use X11 to get the state of modifiers Alt, Ctrl, Shift +.TP .I \-g, \-\-oldmouse Force a "normal tracking" mouse mode. Used when running on xterm\-capable terminals (tmux/screen). diff --git a/doc/man/hu/mc.1.in b/doc/man/hu/mc.1.in index 2deff10ee..0ec73b1da 100644 --- a/doc/man/hu/mc.1.in +++ b/doc/man/hu/mc.1.in @@ -101,6 +101,9 @@ Megmutatja a program verziószámát. Belép xterm módba. (Két képernyős módban használható, és az egér escape szekvenciái is használhatóak). .TP +.I \-X, \-\-no\-x +Do not use X11 to get the state of modifiers Alt, Ctrl, Shift +.TP .I \-g, \-\-oldmouse Force a "normal tracking" mouse mode. Used when running on xterm\-capable terminals (tmux/screen). diff --git a/doc/man/it/mc.1.in b/doc/man/it/mc.1.in index 96d9044f2..258676739 100644 --- a/doc/man/it/mc.1.in +++ b/doc/man/it/mc.1.in @@ -119,6 +119,9 @@ Forza la modalità xterm. Usata quando è in funzione su terminali abilitati\-xterm (due modalità video e in grado di spedire sequenze mouse di escape). .TP +.I \-X, \-\-no\-x +Do not use X11 to get the state of modifiers Alt, Ctrl, Shift +.TP .I \-g, \-\-oldmouse Force a "normal tracking" mouse mode. Used when running on xterm\-capable terminals (tmux/screen). diff --git a/doc/man/mc.1.in b/doc/man/mc.1.in index 62ed107a8..a161a3e6f 100644 --- a/doc/man/mc.1.in +++ b/doc/man/mc.1.in @@ -160,6 +160,9 @@ Display the version of the program. Force xterm mode. Used when running on xterm\-capable terminals (two screen modes, and able to send mouse escape sequences). .TP +.I \-X, \-\-no\-x +Do not use X11 to get the state of modifiers Alt, Ctrl, Shift +.TP .I \-g, \-\-oldmouse Force a "normal tracking" mouse mode. Used when running on xterm\-capable terminals (tmux/screen). diff --git a/doc/man/pl/mc.1.in b/doc/man/pl/mc.1.in index f5cb1b794..2f58e7978 100644 --- a/doc/man/pl/mc.1.in +++ b/doc/man/pl/mc.1.in @@ -104,6 +104,9 @@ Wyświetla wersję programu. Wymusza włączenie trybu xterm. Używane kiedy działa się na terminalach wyposażonych w opcje xterm (dwa tryby ekranu i możliwość wysyłania myszą sygnałów wyjścia). .TP +.I \-X, \-\-no\-x +Do not use X11 to get the state of modifiers Alt, Ctrl, Shift +.TP .I \-g, \-\-oldmouse Force a "normal tracking" mouse mode. Used when running on xterm\-capable terminals (tmux/screen). diff --git a/doc/man/ru/mc.1.in b/doc/man/ru/mc.1.in index c78905645..073b65ada 100644 --- a/doc/man/ru/mc.1.in +++ b/doc/man/ru/mc.1.in @@ -140,6 +140,9 @@ terminfo: в этом случае Midnight Commander использует зн формировать экранирующие последовательности с помощью мыши) (two screen modes, and able to send mouse escape sequences). .TP +.I \-X, \-\-no\-x +Не использовать X11 для получения состояния модификаторов Alt, Ctrl, Shift. +.TP .I \-g, \-\-oldmouse Принудительно устанавливает режим мыши "normal tracking". В xterm-совместимых терминалах (например, tmux/screen). diff --git a/doc/man/sr/mc.1.in b/doc/man/sr/mc.1.in index 4364efe8b..3f9e3f4c9 100644 --- a/doc/man/sr/mc.1.in +++ b/doc/man/sr/mc.1.in @@ -99,6 +99,9 @@ termcap/terminfo. Корисно је само на ХП\-овим термин терминалима који имају подршку за Икс терминале (два екранска режима, и могућност слања мишјих комбинација избегавања). .TP +.I \-X, \-\-no\-x +Do not use X11 to get the state of modifiers Alt, Ctrl, Shift +.TP .I \-g, \-\-oldmouse Force a "normal tracking" mouse mode. Used when running on xterm\-capable terminals (tmux/screen). diff --git a/lib/global.c b/lib/global.c index 60c39f3cd..2a9fc620d 100644 --- a/lib/global.c +++ b/lib/global.c @@ -98,6 +98,7 @@ mc_global_t mc_global = { .winch_flag = FALSE, .command_line_colors = NULL, .xterm_flag = FALSE, + .disable_x11 = FALSE, .slow_terminal = FALSE, .disable_colors = FALSE, .ugly_line_drawing = FALSE, diff --git a/lib/global.h b/lib/global.h index c453177f7..39c660362 100644 --- a/lib/global.h +++ b/lib/global.h @@ -247,6 +247,9 @@ typedef struct /* It is used by function view_other_cmd() */ gboolean xterm_flag; + /* disable x11 support */ + gboolean disable_x11; + /* For slow terminals */ /* If true lines are shown by spaces */ gboolean slow_terminal; diff --git a/lib/tty/key.c b/lib/tty/key.c index 952539498..e32843115 100644 --- a/lib/tty/key.c +++ b/lib/tty/key.c @@ -667,7 +667,7 @@ static void init_key_x11 (void) { #ifdef HAVE_TEXTMODE_X11_SUPPORT - if (getenv ("DISPLAY") != NULL) + if (getenv ("DISPLAY") != NULL && !mc_global.tty.disable_x11) { x11_display = mc_XOpenDisplay (0); diff --git a/src/args.c b/src/args.c index 6e63eac09..3c009362e 100644 --- a/src/args.c +++ b/src/args.c @@ -202,6 +202,13 @@ static const GOptionEntry argument_terminal_table[] = { NULL }, + { + "no-x11", 'X', ARGS_TERM_OPTIONS, G_OPTION_ARG_NONE, + &mc_global.tty.disable_x11, + N_("Disable X11 support"), + NULL + }, + { "oldmouse", 'g', ARGS_TERM_OPTIONS, G_OPTION_ARG_NONE, &mc_global.tty.old_mouse,