diff --git a/src/bfu/menu.c b/src/bfu/menu.c index a7e1fb064..09a3e4857 100644 --- a/src/bfu/menu.c +++ b/src/bfu/menu.c @@ -868,10 +868,16 @@ void do_mainmenu(struct terminal *term, struct menu_item *items, void *data, int sel) { - struct menu *menu = mem_calloc(1, sizeof(*menu)); + int init = 0; + struct menu *menu; - if (!menu) return; + if (!term->main_menu) { + term->main_menu = mem_calloc(1, sizeof(*menu)); + if (!term->main_menu) return; + init = 1; + } + menu = term->main_menu; menu->selected = (sel == -1 ? 0 : sel); menu->items = items; menu->data = data; @@ -882,7 +888,20 @@ do_mainmenu(struct terminal *term, struct menu_item *items, clear_hotkeys_cache(menu); #endif init_hotkeys(term, menu); - add_window(term, mainmenu_handler, menu); + if (init) { + menu->selected = -1; + add_window(term, mainmenu_handler, menu); + } else { + struct window *win; + + foreach (win, term->windows) { + if (win->data == menu) { + del_from_list(win); + add_at_pos((struct window *) &term->windows, win); + break; + } + } + } if (sel != -1) { select_menu(term, menu); @@ -1107,8 +1126,10 @@ mainmenu_kbd_handler(struct menu *menu, struct term_event *ev) } case ACT_MENU_CANCEL: - delete_window_ev(win, action_id != ACT_MENU_CANCEL ? ev : NULL); - return; + menu->selected = -1; + del_from_list(win); + add_to_list_end(win->term->windows, win); + break; } /* Redraw the menu */ diff --git a/src/config/options.inc b/src/config/options.inc index 649bd4940..032aa21d3 100644 --- a/src/config/options.inc +++ b/src/config/options.inc @@ -1177,6 +1177,10 @@ static struct option_info config_options_info[] = { N_("Language of user interface. 'System' means that the language will\n" "be extracted from the environment dynamically.")), + INIT_OPT_BOOL("ui", N_("Display menu bar always"), + "show_menu_bar_always", 0, 0, + N_("Always show menu bar on the screen.")), + INIT_OPT_BOOL("ui", N_("Display status bar"), "show_status_bar", 0, 1, N_("Show status bar on the screen.")), diff --git a/src/dialogs/status.c b/src/dialogs/status.c index 0eaa948a9..69bd61ca3 100644 --- a/src/dialogs/status.c +++ b/src/dialogs/status.c @@ -379,11 +379,14 @@ display_title_bar(struct session *ses, struct terminal *term) unsigned char buf[40]; int buflen = 0; int height; - struct box box; /* Clear the old title */ - set_box(&box, 0, 0, term->width, 1); - draw_box(term, &box, ' ', 0, get_bfu_color(term, "title.title-bar")); + if (!get_opt_bool("ui.show_menu_bar_always")) { + struct box box; + + set_box(&box, 0, 0, term->width, 1); + draw_box(term, &box, ' ', 0, get_bfu_color(term, "title.title-bar")); + } doc_view = current_frame(ses); if (!doc_view || !doc_view->document) return; diff --git a/src/terminal/terminal.h b/src/terminal/terminal.h index 0689f098e..f02707bf4 100644 --- a/src/terminal/terminal.h +++ b/src/terminal/terminal.h @@ -88,6 +88,8 @@ struct terminal { /* This is the screen. See terminal/screen.h */ struct terminal_screen *screen; + /* This is for displaying main menu */ + struct menu *main_menu; /* These are pipes for communication with the ELinks instance owning * this terminal. */ int fdin, fdout; diff --git a/src/viewer/action.c b/src/viewer/action.c index 673186ac3..cefbf6390 100644 --- a/src/viewer/action.c +++ b/src/viewer/action.c @@ -70,6 +70,9 @@ do_action(struct session *ses, enum main_action action_id, int verbose) struct document_view *doc_view = current_frame(ses); struct link *link = NULL; + /* FIXME: Move it to appropriate place */ + if (!term->main_menu) activate_bfu_technology(ses, -1); + if (action_id == -1) goto unknown_action; if (doc_view && doc_view->vs) {