Index: src/screen.c =================================================================== RCS file: /cvs/gnome/mc/src/screen.c,v retrieving revision 1.148 diff -u -r1.148 screen.c --- src/screen.c 21 Dec 2002 08:43:15 -0000 1.148 +++ src/screen.c 22 Dec 2002 23:55:14 -0000 @@ -2171,6 +2171,8 @@ } else subshell_chdir (panel->cwd); + update_xterm_title_path (); + show_dir (panel); select_item (panel); Index: src/main.c =================================================================== RCS file: /cvs/gnome/mc/src/main.c,v retrieving revision 1.265 diff -u -r1.265 main.c --- src/main.c 21 Dec 2002 08:43:15 -0000 1.265 +++ src/main.c 22 Dec 2002 23:55:19 -0000 @@ -800,8 +800,10 @@ int r; r = _do_panel_cd (panel, new_dir, cd_type); - if (r) + if (r) { directory_history_add (cpanel, cpanel->cwd); + update_xterm_title_path (); + } return r; } @@ -1655,8 +1657,6 @@ save_hotlist (); done_screen (); vfs_add_current_stamps (); - if (xterm_flag && xterm_hintbar) - set_hintbar (_("Thank you for using GNU Midnight Commander")); } /* This should be called after destroy_dlg since panel widgets @@ -1839,6 +1839,21 @@ #define xtoolkit_panel_setup() void +update_xterm_title_path (void) +{ + unsigned char *p, *s; + + if (xterm_flag && xterm_title) { + p = s = g_strdup(strip_home_and_password (cpanel->cwd)); + do { + if (*s<=32) *s='?'; + } while (*++s); + fprintf (stdout, "\33]0;mc - \7", p); + fflush (stdout); + } +} + +void load_hint (void) { char *hint; @@ -1846,7 +1861,7 @@ if (!the_hint->widget.parent) return; - if (!message_visible && (!xterm_flag || !xterm_hintbar)) { + if (!message_visible) { label_set_text (the_hint, 0); return; } Index: src/main.h =================================================================== RCS file: /cvs/gnome/mc/src/main.h,v retrieving revision 1.41 diff -u -r1.41 main.h --- src/main.h 15 Nov 2002 06:38:55 -0000 1.41 +++ src/main.h 22 Dec 2002 23:55:20 -0000 @@ -131,6 +131,7 @@ void untouch_bar (void); void touch_bar (void); +void update_xterm_title_path (void); void load_hint (void); void print_vfs_message(char *msg, ...) Index: src/layout.c =================================================================== RCS file: /cvs/gnome/mc/src/layout.c,v retrieving revision 1.51 diff -u -r1.51 layout.c --- src/layout.c 21 Dec 2002 02:09:00 -0000 1.51 +++ src/layout.c 22 Dec 2002 23:55:22 -0000 @@ -98,8 +98,8 @@ /* Set if the nice message (hint) bar is visible */ int message_visible = 1; -/* Set if you want the message bar shown in xterm title bar to save space */ -int xterm_hintbar = 0; +/* Set to show current working dir in xterm window title */ +int xterm_title = 1; /* The starting line for the output of the subprogram */ int output_start_y = 0; @@ -129,7 +129,7 @@ static int _command_prompt; static int _keybar_visible; static int _message_visible; -static int _xterm_hintbar; +static int _xterm_title; static int _permission_mode; static int _filetype_mode; @@ -161,7 +161,7 @@ WCheck *widget; char *tkname; } check_options [] = { - { N_("&Xterm hintbar"), &xterm_hintbar, 0, "h" }, + { N_("&Xterm window title"), &xterm_title, 0, "t" }, { N_("h&Intbar visible"), &message_visible, 0, "v" }, { N_("&Keybar visible"), &keybar_visible, 0, "k" }, { N_("command &Prompt"), &command_prompt, 0, "p" }, @@ -312,14 +312,13 @@ _command_prompt = check_options [4].widget->state & C_BOOL; _keybar_visible = check_options [2].widget->state & C_BOOL; _message_visible = check_options [1].widget->state & C_BOOL; - _xterm_hintbar = check_options [0].widget->state & C_BOOL; + _xterm_title = check_options [0].widget->state & C_BOOL; if (console_flag){ int minimum; if (_output_lines < 0) _output_lines = 0; height = LINES - _keybar_visible - _command_prompt - _menubar_visible - _output_lines - _message_visible; - if (_message_visible && _xterm_hintbar && xterm_flag) height++; minimum = MINHEIGHT * (1 + _horizontal_split); if (height < minimum){ _output_lines -= minimum - height; @@ -328,7 +327,6 @@ } else { height = LINES - _keybar_visible - _command_prompt - _menubar_visible - _output_lines - _message_visible; - if (_message_visible && _xterm_hintbar && xterm_flag) height++; } if (_horizontal_split != radio_widget->sel){ _horizontal_split = radio_widget->sel; @@ -472,7 +470,7 @@ _command_prompt = command_prompt; _keybar_visible = keybar_visible; _message_visible = message_visible; - _xterm_hintbar = xterm_hintbar; + _xterm_title = xterm_title; bright_widget = button_new(6, 15, B_2RIGHT, NARROW_BUTTON, "&>", b2right_cback, 0, ">"); add_widget (layout_dlg, bright_widget); bleft_widget = button_new (6, 9, B_2LEFT, NARROW_BUTTON, "&<", b2left_cback, 0, "<"); @@ -646,8 +644,6 @@ output_lines = 0; height = LINES - keybar_visible - command_prompt - menubar_visible - output_lines - message_visible; - if (message_visible && xterm_hintbar && xterm_flag) - height++; minimum = MINHEIGHT * (1 + horizontal_split); if (height < minimum) { output_lines -= minimum - height; @@ -656,8 +652,6 @@ } else { height = LINES - menubar_visible - command_prompt - keybar_visible - message_visible; - if (message_visible && xterm_hintbar && xterm_flag) - height++; } check_split (); start_y = menubar_visible; @@ -709,12 +703,13 @@ LINES - output_lines - keybar_visible - 1, LINES - keybar_visible - 1); } - if (message_visible && (!xterm_hintbar || !xterm_flag)) + if (message_visible) widget_set_size (&the_hint->widget, height + start_y, 0, 1, COLS); else widget_set_size (&the_hint->widget, 0, 0, 0, 0); load_hint (); + update_xterm_title_path (); } void flag_winch (int dummy) @@ -802,14 +797,9 @@ void set_hintbar(char *str) { - if (xterm_flag && xterm_hintbar) { - fprintf (stdout, "\33]0;mc - \7", str); - fflush (stdout); - } else { - label_set_text (the_hint, str); - if (ok_to_refresh > 0) - refresh(); - } + label_set_text (the_hint, str); + if (ok_to_refresh > 0) + refresh(); } void print_vfs_message (char *msg, ...) @@ -844,7 +834,7 @@ return; } - if (message_visible || (xterm_flag && xterm_hintbar)) { + if (message_visible) { set_hintbar(str); } } Index: src/layout.h =================================================================== RCS file: /cvs/gnome/mc/src/layout.h,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 layout.h --- src/layout.h 27 Feb 1998 04:54:43 -0000 1.1.1.1 +++ src/layout.h 22 Dec 2002 23:55:23 -0000 @@ -34,7 +34,7 @@ extern int layout_do_change; extern int output_start_y; extern int message_visible; -extern int xterm_hintbar; +extern int xterm_title; extern int horizontal_split; extern int nice_rotating_dash; Index: src/setup.c =================================================================== RCS file: /cvs/gnome/mc/src/setup.c,v retrieving revision 1.70 diff -u -r1.70 setup.c --- src/setup.c 8 Dec 2002 04:16:31 -0000 1.70 +++ src/setup.c 22 Dec 2002 23:55:24 -0000 @@ -121,7 +121,7 @@ { "first_panel_size", &first_panel_size }, { "message_visible", &message_visible }, { "keybar_visible", &keybar_visible }, - { "xterm_hintbar", &xterm_hintbar }, + { "xterm_title", &xterm_title }, { "output_lines", &output_lines }, { "command_prompt", &command_prompt }, { "menubar_visible", &menubar_visible }, Index: src/ChangeLog =================================================================== RCS file: /cvs/gnome/mc/src/ChangeLog,v retrieving revision 1.1068 diff -u -0 -r1.1068 ChangeLog --- src/ChangeLog 21 Dec 2002 08:43:15 -0000 1.1068 +++ src/ChangeLog 22 Dec 2002 23:57:48 -0000 @@ -0,0 +1,11 @@ +2002-12-21 Adam Byrtek <alpha@debian.org> + + * layout.c, layout.h, setup.c: xterm_hintbar feature removed, + replaced with xterm_title + + * screen.c, main.c: refresh xterm title on panel focus or + panel cd + + * main.c (update_xterm_title_path): show current path in xterm + window title, filter out control chars (<=32) +