Kaydet (Commit) 171b188e authored tarafından Antonio Fernandez's avatar Antonio Fernandez Kaydeden (comit) Bjoern Michaelsen

Menu is properly visible on non-Unity WM.

Change-Id: If9fea1f3b700a0d957aa1ed11913b2a7982050c2
üst 58b5f171
...@@ -102,7 +102,8 @@ public: ...@@ -102,7 +102,8 @@ public:
void DispatchCommand( gint itemId, const gchar* aCommand ); void DispatchCommand( gint itemId, const gchar* aCommand );
void Activate( const gchar* aMenuCommand ); void Activate( const gchar* aMenuCommand );
void Deactivate( const gchar* aMenuCommand ); void Deactivate( const gchar* aMenuCommand );
void DisconnectFrame(); void DisconnectFrame();
void Display( sal_Bool bVisible );
void UpdateNativeMenu(); void UpdateNativeMenu();
// void UpdateNativeSubMenu(); // void UpdateNativeSubMenu();
bool PrepUpdate(); bool PrepUpdate();
......
...@@ -558,36 +558,40 @@ void on_registrar_available( GDBusConnection * /*connection*/, ...@@ -558,36 +558,40 @@ void on_registrar_available( GDBusConnection * /*connection*/,
gpointer user_data ) gpointer user_data )
{ {
SolarMutexGuard aGuard; SolarMutexGuard aGuard;
GtkSalFrame* pSalFrame = reinterpret_cast< GtkSalFrame* >( user_data ); GtkSalFrame* pSalFrame = reinterpret_cast< GtkSalFrame* >( user_data );
GdkWindow* gdkWindow = gtk_widget_get_window( pSalFrame->getWindow() ); GdkWindow* gdkWindow = gtk_widget_get_window( pSalFrame->getWindow() );
ensure_dbus_setup(gdkWindow, pSalFrame); ensure_dbus_setup(gdkWindow, pSalFrame);
SalMenu* pSalMenu = pSalFrame->GetMenu(); SalMenu* pSalMenu = pSalFrame->GetMenu();
if ( pSalMenu != NULL ) if ( pSalMenu != NULL )
{ {
GtkSalMenu* pGtkSalMenu = static_cast<GtkSalMenu*>(pSalMenu); GtkSalMenu* pGtkSalMenu = static_cast<GtkSalMenu*>(pSalMenu);
pGtkSalMenu->UpdateNativeMenu(); pGtkSalMenu->UpdateNativeMenu();
MenuBar* pMenuBar = static_cast< MenuBar* >( pGtkSalMenu->GetMenu() ); pGtkSalMenu->Display( sal_True );
if(pMenuBar)
pMenuBar->SetDisplayable(false);
} }
} }
//This is called when the registrar becomes unavailable. It shows the menubar. // This is called when the registrar becomes unavailable. It shows the menubar.
void on_registrar_unavailable (GDBusConnection * /*connection*/, void on_registrar_unavailable( GDBusConnection * /*connection*/,
const gchar * /*name*/, const gchar * /*name*/,
gpointer user_data) gpointer user_data )
{ {
SolarMutexGuard aGuard; SolarMutexGuard aGuard;
SAL_INFO("vcl.unity", "on_registrar_unavailable"); SAL_INFO("vcl.unity", "on_registrar_unavailable");
pSessionBus = NULL; pSessionBus = NULL;
GtkSalFrame* pSalFrame = reinterpret_cast< GtkSalFrame* >( user_data ); GtkSalFrame* pSalFrame = reinterpret_cast< GtkSalFrame* >( user_data );
SalMenu* pSalMenu = pSalFrame->GetMenu(); SalMenu* pSalMenu = pSalFrame->GetMenu();
if ( pSalMenu ) { if ( pSalMenu ) {
GtkSalMenu* pGtkSalMenu = static_cast<GtkSalMenu*>(pSalMenu); GtkSalMenu* pGtkSalMenu = static_cast< GtkSalMenu* >( pSalMenu );
pGtkSalMenu->DisconnectFrame(); pGtkSalMenu->DisconnectFrame();
MenuBar* pMenuBar = static_cast< MenuBar* >( pGtkSalMenu->GetMenu() ); pGtkSalMenu->Display( sal_False );
pMenuBar->SetDisplayable( false );
} }
} }
......
...@@ -37,6 +37,8 @@ ...@@ -37,6 +37,8 @@
#include <sal/log.hxx> #include <sal/log.hxx>
static sal_Bool bMenuVisibility = sal_False;
static gchar* GetCommandForSpecialItem( GtkSalMenuItem* pSalMenuItem ) static gchar* GetCommandForSpecialItem( GtkSalMenuItem* pSalMenuItem )
{ {
gchar* aCommand = NULL; gchar* aCommand = NULL;
...@@ -380,16 +382,6 @@ void GtkSalMenu::UpdateNativeMenu() ...@@ -380,16 +382,6 @@ void GtkSalMenu::UpdateNativeMenu()
RemoveUnusedCommands( pActionGroup, pOldCommandList, pNewCommandList ); RemoveUnusedCommands( pActionGroup, pOldCommandList, pNewCommandList );
} }
void GtkSalMenu::DisconnectFrame()
{
if(mbMenuBar)
{
mpMenuModel = NULL;
mpActionGroup = NULL;
mpFrame = NULL;
}
}
/* /*
* GtkSalMenu * GtkSalMenu
...@@ -416,7 +408,7 @@ GtkSalMenu::~GtkSalMenu() ...@@ -416,7 +408,7 @@ GtkSalMenu::~GtkSalMenu()
sal_Bool GtkSalMenu::VisibleMenuBar() sal_Bool GtkSalMenu::VisibleMenuBar()
{ {
return true; return bMenuVisibility;
} }
void GtkSalMenu::InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos ) void GtkSalMenu::InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos )
...@@ -491,7 +483,6 @@ void GtkSalMenu::SetFrame( const SalFrame* pFrame ) ...@@ -491,7 +483,6 @@ void GtkSalMenu::SetFrame( const SalFrame* pFrame )
// Generate the main menu structure. // Generate the main menu structure.
UpdateNativeMenu(); UpdateNativeMenu();
} }
const GtkSalFrame* GtkSalMenu::GetFrame() const const GtkSalFrame* GtkSalMenu::GetFrame() const
...@@ -708,7 +699,7 @@ void GtkSalMenu::Activate( const gchar* aMenuCommand ) ...@@ -708,7 +699,7 @@ void GtkSalMenu::Activate( const gchar* aMenuCommand )
void GtkSalMenu::Deactivate( const gchar* aMenuCommand ) void GtkSalMenu::Deactivate( const gchar* aMenuCommand )
{ {
if ( mbMenuBar != TRUE ) if ( mbMenuBar == sal_False )
return; return;
GtkSalMenu* pSalSubMenu = GetMenuForItemCommand( (gchar*) aMenuCommand, TRUE ); GtkSalMenu* pSalSubMenu = GetMenuForItemCommand( (gchar*) aMenuCommand, TRUE );
...@@ -719,6 +710,29 @@ void GtkSalMenu::Deactivate( const gchar* aMenuCommand ) ...@@ -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 ) sal_Bool GtkSalMenu::IsItemVisible( unsigned nPos )
{ {
SolarMutexGuard aGuard; SolarMutexGuard aGuard;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment