From 2b55c54efc8a274967f4f20e6c2574f4e3f9a3fd Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Wed, 14 Aug 2019 11:37:50 +0300 Subject: [PATCH] Menubar is always on top line of screen. Signed-off-by: Andrew Borodin --- lib/widget/menu.c | 5 +++-- lib/widget/menu.h | 2 +- src/editor/editwidget.c | 2 +- src/filemanager/midnight.c | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/widget/menu.c b/lib/widget/menu.c index 95127260b..e75f0738e 100644 --- a/lib/widget/menu.c +++ b/lib/widget/menu.c @@ -935,14 +935,15 @@ destroy_menu (menu_t * menu) /* --------------------------------------------------------------------------------------------- */ WMenuBar * -menubar_new (int y, int x, int cols, GList * menu, gboolean visible) +menubar_new (GList * menu, gboolean visible) { WMenuBar *menubar; Widget *w; menubar = g_new0 (WMenuBar, 1); w = WIDGET (menubar); - widget_init (w, y, x, 1, cols, menubar_callback, menubar_mouse_callback); + widget_init (w, 0, 0, 1, COLS, menubar_callback, menubar_mouse_callback); + w->pos_flags = WPOS_KEEP_HORZ | WPOS_KEEP_TOP; /* initially, menubar is not selectable */ widget_set_options (w, WOP_SELECTABLE, FALSE); w->options |= WOP_TOP_SELECT; diff --git a/lib/widget/menu.h b/lib/widget/menu.h index 5d9323517..c522a16c8 100644 --- a/lib/widget/menu.h +++ b/lib/widget/menu.h @@ -48,7 +48,7 @@ menu_t *create_menu (const char *name, GList * entries, const char *help_node); void menu_set_name (menu_t * menu, const char *name); void destroy_menu (menu_t * menu); -WMenuBar *menubar_new (int y, int x, int cols, GList * menu, gboolean visible); +WMenuBar *menubar_new (GList * menu, gboolean visible); void menubar_set_menu (WMenuBar * menubar, GList * menu); void menubar_add_menu (WMenuBar * menubar, menu_t * menu); void menubar_arrange (WMenuBar * menubar); diff --git a/src/editor/editwidget.c b/src/editor/editwidget.c index 65f9874fc..33b902f78 100644 --- a/src/editor/editwidget.c +++ b/src/editor/editwidget.c @@ -1251,7 +1251,7 @@ edit_files (const GList * files) edit_dlg->get_shortcut = edit_get_shortcut; edit_dlg->get_title = edit_get_title; - menubar = menubar_new (0, 0, COLS, NULL, TRUE); + menubar = menubar_new (NULL, TRUE); add_widget (edit_dlg, menubar); edit_init_menu (menubar); diff --git a/src/filemanager/midnight.c b/src/filemanager/midnight.c index dec82e916..8da538d8b 100644 --- a/src/filemanager/midnight.c +++ b/src/filemanager/midnight.c @@ -922,7 +922,7 @@ create_file_manager (void) /* allow rebind tab */ widget_want_tab (WIDGET (midnight_dlg), TRUE); - the_menubar = menubar_new (0, 0, COLS, NULL, menubar_visible); + the_menubar = menubar_new (NULL, menubar_visible); add_widget (midnight_dlg, the_menubar); init_menu ();