diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2017-03-08 11:46:04 +0200 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2017-03-09 01:58:23 +0200 |
commit | 3daa6c66eb9a4c334d6f72a8fd4bb09d7360a913 (patch) | |
tree | 841ca73c149de1150a708b13cf510d2ae4c40cb8 /vcl/unx | |
parent | 9def779821324c73f81344b2b2d59f1e875903db (diff) |
Don't use SetDisplayable when enabling Unity mode
because now it tracks the global menu too, but all we need
here is to hide the in-window menubar widget.
Change-Id: Ic3c8c20b88d37430e80b682333ca384bccc3f697
Diffstat (limited to 'vcl/unx')
-rw-r--r-- | vcl/unx/gtk/gtksalmenu.cxx | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/vcl/unx/gtk/gtksalmenu.cxx b/vcl/unx/gtk/gtksalmenu.cxx index 1b5481b9ad91..e4d2ebab2c31 100644 --- a/vcl/unx/gtk/gtksalmenu.cxx +++ b/vcl/unx/gtk/gtksalmenu.cxx @@ -766,6 +766,9 @@ static gboolean MenuBarSignalKey(GtkWidget*, GdkEventKey* pEvent, gpointer menu) void GtkSalMenu::CreateMenuBarWidget() { #if GTK_CHECK_VERSION(3,0,0) + if (mpMenuBarContainerWidget) + return; + GtkGrid* pGrid = mpFrame->getTopLevelGridWidget(); mpMenuBarContainerWidget = gtk_grid_new(); @@ -1153,14 +1156,20 @@ void GtkSalMenu::Deactivate(const gchar* pCommand) void GtkSalMenu::EnableUnity(bool bEnable) { - if (bUnityMode != bEnable) - { - static_cast<MenuBar*>(mpVCLMenu.get())->SetDisplayable(!bEnable); - bUnityMode = bEnable; + bUnityMode = bEnable; + + MenuBar* pMenuBar(static_cast<MenuBar*>(mpVCLMenu.get())); - if (!bEnable) - ShowMenuBar(true); + if (bEnable) + DestroyMenuBarWidget(); + else + { + Update(); + if (pMenuBar->IsDisplayable()) + CreateMenuBarWidget(); } + + pMenuBar->LayoutChanged(); } void GtkSalMenu::ShowMenuBar( bool bVisible ) @@ -1173,7 +1182,7 @@ void GtkSalMenu::ShowMenuBar( bool bVisible ) else if (mpMenuModel && g_menu_model_get_n_items(G_MENU_MODEL(mpMenuModel)) > 0) g_lo_menu_remove(G_LO_MENU(mpMenuModel), 0); } - else if (bVisible && !mpMenuBarContainerWidget) + else if (bVisible) CreateMenuBarWidget(); else DestroyMenuBarWidget(); |