diff options
author | Antonio Fernandez <antonio.fernandez@aentos.es> | 2012-10-06 14:46:26 +0100 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2012-11-14 13:52:55 +0100 |
commit | 171b188e41360e9e87043a861beeaff002a5d53d (patch) | |
tree | eb6e2fd1f045ac0e661a6053818bad50b9849afa /vcl | |
parent | 58b5f1714ddab4afec382f535887cf6f98a4c11b (diff) |
Menu is properly visible on non-Unity WM.
Change-Id: If9fea1f3b700a0d957aa1ed11913b2a7982050c2
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/unx/gtk/gtksalmenu.hxx | 3 | ||||
-rw-r--r-- | vcl/unx/gtk/window/gtkframe.cxx | 24 | ||||
-rw-r--r-- | vcl/unx/gtk/window/gtksalmenu.cxx | 40 |
3 files changed, 43 insertions, 24 deletions
diff --git a/vcl/inc/unx/gtk/gtksalmenu.hxx b/vcl/inc/unx/gtk/gtksalmenu.hxx index 7dadbfca521d..6e7084bdc3e9 100644 --- a/vcl/inc/unx/gtk/gtksalmenu.hxx +++ b/vcl/inc/unx/gtk/gtksalmenu.hxx @@ -102,7 +102,8 @@ public: void DispatchCommand( gint itemId, const gchar* aCommand ); void Activate( const gchar* aMenuCommand ); void Deactivate( const gchar* aMenuCommand ); - void DisconnectFrame(); + void DisconnectFrame(); + void Display( sal_Bool bVisible ); void UpdateNativeMenu(); // void UpdateNativeSubMenu(); bool PrepUpdate(); diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx index 2bf92c75fdef..1107aed37cf3 100644 --- a/vcl/unx/gtk/window/gtkframe.cxx +++ b/vcl/unx/gtk/window/gtkframe.cxx @@ -558,36 +558,40 @@ void on_registrar_available( GDBusConnection * /*connection*/, gpointer user_data ) { SolarMutexGuard aGuard; + GtkSalFrame* pSalFrame = reinterpret_cast< GtkSalFrame* >( user_data ); GdkWindow* gdkWindow = gtk_widget_get_window( pSalFrame->getWindow() ); + ensure_dbus_setup(gdkWindow, pSalFrame); + SalMenu* pSalMenu = pSalFrame->GetMenu(); + if ( pSalMenu != NULL ) { GtkSalMenu* pGtkSalMenu = static_cast<GtkSalMenu*>(pSalMenu); pGtkSalMenu->UpdateNativeMenu(); - MenuBar* pMenuBar = static_cast< MenuBar* >( pGtkSalMenu->GetMenu() ); - if(pMenuBar) - pMenuBar->SetDisplayable(false); + pGtkSalMenu->Display( sal_True ); } } -//This is called when the registrar becomes unavailable. It shows the menubar. -void on_registrar_unavailable (GDBusConnection * /*connection*/, - const gchar * /*name*/, - gpointer user_data) +// This is called when the registrar becomes unavailable. It shows the menubar. +void on_registrar_unavailable( GDBusConnection * /*connection*/, + const gchar * /*name*/, + gpointer user_data ) { SolarMutexGuard aGuard; + SAL_INFO("vcl.unity", "on_registrar_unavailable"); + pSessionBus = NULL; GtkSalFrame* pSalFrame = reinterpret_cast< GtkSalFrame* >( user_data ); + SalMenu* pSalMenu = pSalFrame->GetMenu(); if ( pSalMenu ) { - GtkSalMenu* pGtkSalMenu = static_cast<GtkSalMenu*>(pSalMenu); + GtkSalMenu* pGtkSalMenu = static_cast< GtkSalMenu* >( pSalMenu ); pGtkSalMenu->DisconnectFrame(); - MenuBar* pMenuBar = static_cast< MenuBar* >( pGtkSalMenu->GetMenu() ); - pMenuBar->SetDisplayable( false ); + pGtkSalMenu->Display( sal_False ); } } diff --git a/vcl/unx/gtk/window/gtksalmenu.cxx b/vcl/unx/gtk/window/gtksalmenu.cxx index 5a9ac3dfd6af..3e2664e2f24b 100644 --- a/vcl/unx/gtk/window/gtksalmenu.cxx +++ b/vcl/unx/gtk/window/gtksalmenu.cxx @@ -37,6 +37,8 @@ #include <sal/log.hxx> +static sal_Bool bMenuVisibility = sal_False; + static gchar* GetCommandForSpecialItem( GtkSalMenuItem* pSalMenuItem ) { gchar* aCommand = NULL; @@ -380,16 +382,6 @@ void GtkSalMenu::UpdateNativeMenu() RemoveUnusedCommands( pActionGroup, pOldCommandList, pNewCommandList ); } -void GtkSalMenu::DisconnectFrame() -{ - if(mbMenuBar) - { - mpMenuModel = NULL; - mpActionGroup = NULL; - mpFrame = NULL; - } -} - /* * GtkSalMenu @@ -416,7 +408,7 @@ GtkSalMenu::~GtkSalMenu() sal_Bool GtkSalMenu::VisibleMenuBar() { - return true; + return bMenuVisibility; } void GtkSalMenu::InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos ) @@ -491,7 +483,6 @@ void GtkSalMenu::SetFrame( const SalFrame* pFrame ) // Generate the main menu structure. UpdateNativeMenu(); - } const GtkSalFrame* GtkSalMenu::GetFrame() const @@ -708,7 +699,7 @@ void GtkSalMenu::Activate( const gchar* aMenuCommand ) void GtkSalMenu::Deactivate( const gchar* aMenuCommand ) { - if ( mbMenuBar != TRUE ) + if ( mbMenuBar == sal_False ) return; GtkSalMenu* pSalSubMenu = GetMenuForItemCommand( (gchar*) aMenuCommand, TRUE ); @@ -719,6 +710,29 @@ void GtkSalMenu::Deactivate( const gchar* aMenuCommand ) } } +void GtkSalMenu::DisconnectFrame() +{ + if( mbMenuBar == sal_True ) + { + mpMenuModel = NULL; + mpActionGroup = NULL; + mpFrame = NULL; + } +} + +void GtkSalMenu::Display( sal_Bool bVisible ) +{ + if ( mbMenuBar == sal_False || mpVCLMenu == NULL ) + return; + + bMenuVisibility = bVisible; + + sal_Bool bVCLMenuVisible = ( bVisible == sal_True ) ? sal_False : sal_True; + + MenuBar* pMenuBar = static_cast< MenuBar* >( mpVCLMenu ); + pMenuBar->SetDisplayable( bVCLMenuVisible ); +} + sal_Bool GtkSalMenu::IsItemVisible( unsigned nPos ) { SolarMutexGuard aGuard; |