[Libreoffice-commits] core.git: sfx2/source vcl/inc vcl/source vcl/unx
Maxim Monastirsky
momonasmon at gmail.com
Wed Aug 31 05:56:01 UTC 2016
sfx2/source/appl/appserv.cxx | 2 --
vcl/inc/salmenu.hxx | 2 +-
vcl/inc/unx/gtk/gtksalmenu.hxx | 1 +
vcl/source/window/menu.cxx | 3 +++
vcl/unx/gtk/gtksalmenu.cxx | 27 +++++++++++++++++----------
5 files changed, 22 insertions(+), 13 deletions(-)
New commits:
commit 72eb18e520ea8165a6a20958a1551f55e5e14cab
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Tue Aug 30 21:38:37 2016 +0300
gtk3: Implement menubar hiding
Change-Id: Ia772f05daa74453fc3dc8fe0c257fdac358cd5c6
Reviewed-on: https://gerrit.libreoffice.org/28490
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Maxim Monastirsky <momonasmon at gmail.com>
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index 1afe604..659fbf9 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -1121,8 +1121,6 @@ void SfxApplication::MiscState_Impl(SfxItemSet &rSet)
SfxBoolItem aItem( SID_MENUBAR, bState );
rSet.Put( aItem );
}
- if ( Application::GetToolkitName().compareTo( "gtk3" ) == 0 )
- rSet.DisableItem( SID_MENUBAR );
break;
}
diff --git a/vcl/inc/salmenu.hxx b/vcl/inc/salmenu.hxx
index ed7296a..734518d 100644
--- a/vcl/inc/salmenu.hxx
+++ b/vcl/inc/salmenu.hxx
@@ -63,7 +63,7 @@ public:
virtual bool VisibleMenuBar() = 0; // must return true to actually DISPLAY native menu bars
// otherwise only menu messages are processed (eg, OLE on Windows)
-
+ virtual void ShowMenuBar( bool ) {}
virtual void InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos ) = 0;
virtual void RemoveItem( unsigned nPos ) = 0;
virtual void SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned nPos ) = 0;
diff --git a/vcl/inc/unx/gtk/gtksalmenu.hxx b/vcl/inc/unx/gtk/gtksalmenu.hxx
index 7cd93dd..b6c1042 100644
--- a/vcl/inc/unx/gtk/gtksalmenu.hxx
+++ b/vcl/inc/unx/gtk/gtksalmenu.hxx
@@ -109,6 +109,7 @@ public:
static void Activate(const gchar* pMenuCommand);
static void Deactivate(const gchar* pMenuCommand);
void EnableUnity(bool bEnable);
+ virtual void ShowMenuBar( bool bVisible ) override;
bool PrepUpdate();
virtual void Update() override; // Update this menu only.
// Update full menu hierarchy from this menu.
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 59597c5..c82ecf5 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -2495,6 +2495,9 @@ void MenuBar::SetDisplayable( bool bDisplayable )
{
if( bDisplayable != mbDisplayable )
{
+ if ( ImplGetSalMenu() )
+ ImplGetSalMenu()->ShowMenuBar( bDisplayable );
+
mbDisplayable = bDisplayable;
MenuBarWindow* pMenuWin = getMenuBarWindow();
if (pMenuWin)
diff --git a/vcl/unx/gtk/gtksalmenu.cxx b/vcl/unx/gtk/gtksalmenu.cxx
index 8856410..2934121 100644
--- a/vcl/unx/gtk/gtksalmenu.cxx
+++ b/vcl/unx/gtk/gtksalmenu.cxx
@@ -485,11 +485,7 @@ GtkSalMenu::~GtkSalMenu()
bool GtkSalMenu::VisibleMenuBar()
{
-#if GTK_CHECK_VERSION(3,0,0)
- return mbMenuBar;
-#else
- return mbMenuBar && bUnityMode;
-#endif
+ return mbMenuBar && (bUnityMode || mpMenuBarContainerWidget);
}
void GtkSalMenu::InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos )
@@ -540,7 +536,9 @@ void GtkSalMenu::ShowCloseButton(bool bShow)
{
#if GTK_CHECK_VERSION(3,0,0)
assert(mbMenuBar);
- MenuBar *pVclMenuBar = static_cast<MenuBar*>(mpVCLMenu.get());
+ if (!mpMenuBarContainerWidget)
+ return;
+
if (!bShow)
{
if (mpCloseButton)
@@ -548,6 +546,7 @@ void GtkSalMenu::ShowCloseButton(bool bShow)
return;
}
+ MenuBar *pVclMenuBar = static_cast<MenuBar*>(mpVCLMenu.get());
mpCloseButton = gtk_button_new();
g_signal_connect(mpCloseButton, "clicked", G_CALLBACK(CloseMenuBar), pVclMenuBar);
@@ -703,6 +702,8 @@ void GtkSalMenu::CreateMenuBarWidget()
g_signal_connect(G_OBJECT(mpMenuBarWidget), "key-press-event", G_CALLBACK(MenuBarSignalKey), this);
gtk_widget_show_all(mpMenuBarContainerWidget);
+
+ ShowCloseButton( static_cast<MenuBar*>(mpVCLMenu.get())->HasCloseButton() );
#else
(void)mpMenuBarContainerWidget;
#endif
@@ -715,6 +716,7 @@ void GtkSalMenu::DestroyMenuBarWidget()
{
gtk_widget_destroy(mpMenuBarContainerWidget);
mpMenuBarContainerWidget = nullptr;
+ mpCloseButton = nullptr;
}
#else
(void)mpMenuBarContainerWidget;
@@ -1082,14 +1084,19 @@ void GtkSalMenu::EnableUnity(bool bEnable)
{
if (bUnityMode != bEnable)
{
- if (!bEnable)
- CreateMenuBarWidget();
- else
- DestroyMenuBarWidget();
bUnityMode = bEnable;
+ static_cast<MenuBar*>(mpVCLMenu.get())->SetDisplayable(!bEnable);
}
}
+void GtkSalMenu::ShowMenuBar( bool bVisible )
+{
+ if (bVisible && !bUnityMode && !mpMenuBarContainerWidget)
+ CreateMenuBarWidget();
+ else
+ DestroyMenuBarWidget();
+}
+
bool GtkSalMenu::IsItemVisible( unsigned nPos )
{
SolarMutexGuard aGuard;
More information about the Libreoffice-commits
mailing list