lp#1085169: we overactivate here, as it does not seem to hurt

Change-Id: I4f6e76347c5c9b5c67a09b8c3dcd1b1708e8e703
This commit is contained in:
Bjoern Michaelsen 2013-04-19 11:13:05 +02:00
parent bffb03fbc1
commit 26d092b363
3 changed files with 23 additions and 19 deletions

View file

@ -52,6 +52,7 @@ private:
GtkSalMenu* GetMenuForItemCommand( gchar* aCommand, gboolean bGetSubmenu );
void ImplUpdate( gboolean bRecurse );
void ActivateAllSubmenus(MenuBar* pMenuBar);
public:
GtkSalMenu( sal_Bool bMenuBar );
@ -97,7 +98,7 @@ public:
void NativeSetAccelerator( unsigned nSection, unsigned nItemPos, const KeyCode& rKeyCode, const OUString& rKeyName );
void DispatchCommand( gint itemId, const gchar* aCommand );
void Activate( const gchar* aMenuCommand );
void Activate();
void Deactivate( const gchar* aMenuCommand );
void Display( sal_Bool bVisible );
bool PrepUpdate();

View file

@ -167,20 +167,22 @@ g_lo_action_group_perform_submenu_action (GLOActionGroup *group,
const gchar *action_name,
GVariant *state)
{
SAL_INFO("vcl.unity", "g_lo_action_group_perform_submenu_action on " << group);
GtkSalFrame* pFrame = group->priv->frame;
SAL_INFO("vcl.unity", "g_lo_action_group_perform_submenu_action on " << group << " for frame " << pFrame);
if (pFrame == NULL)
return;
GtkSalMenu* pSalMenu = static_cast<GtkSalMenu*> (pFrame->GetMenu());
SAL_INFO("vcl.unity", "g_lo_action_group_perform_submenu_action on " << group << " for menu " << pSalMenu);
if (pSalMenu != NULL) {
gboolean bState = g_variant_get_boolean (state);
SAL_INFO("vcl.unity", "g_lo_action_group_perform_submenu_action on " << group << " to " << bState);
if (bState)
pSalMenu->Activate (action_name);
pSalMenu->Activate();
else
pSalMenu->Deactivate (action_name);
}
@ -191,7 +193,6 @@ g_lo_action_group_change_state (GActionGroup *group,
const gchar *action_name,
GVariant *value)
{
SAL_INFO("vcl.unity", "g_lo_action_group_perform_submenu_action on " << group);
g_return_if_fail (value != NULL);
g_variant_ref_sink (value);

View file

@ -353,10 +353,6 @@ void GtkSalMenu::ImplUpdate( gboolean bRecurse )
SAL_INFO("vcl.unity", "preparing submenu " << pSubMenuModel << " to menu model " << G_MENU_MODEL(pSubMenuModel) << " and action group " << G_ACTION_GROUP(pActionGroup));
pSubmenu->SetMenuModel( G_MENU_MODEL( pSubMenuModel ) );
pSubmenu->SetActionGroup( G_ACTION_GROUP( pActionGroup ) );
pSubmenu->GetMenu()->Activate();
pSubmenu->GetMenu()->Deactivate();
pSubmenu->ImplUpdate( bRecurse );
}
}
@ -658,7 +654,6 @@ GtkSalMenu* GtkSalMenu::GetMenuForItemCommand( gchar* aCommand, gboolean bGetSub
{
SolarMutexGuard aGuard;
GtkSalMenu* pMenu = NULL;
for ( sal_uInt16 nPos = 0; nPos < maItems.size(); nPos++ )
{
GtkSalMenuItem *pSalItem = maItems[ nPos ];
@ -695,24 +690,31 @@ void GtkSalMenu::DispatchCommand( gint itemId, const gchar *aCommand )
Menu* pSubMenu = ( pSalSubMenu != NULL ) ? pSalSubMenu->GetMenu() : NULL;
MenuBar* pMenuBar = static_cast< MenuBar* >( mpVCLMenu );
pMenuBar->HandleMenuCommandEvent( pSubMenu, itemId );
}
void GtkSalMenu::Activate( const gchar* aMenuCommand )
void GtkSalMenu::ActivateAllSubmenus(MenuBar* pMenuBar)
{
pMenuBar->HandleMenuActivateEvent(mpVCLMenu);
for ( sal_uInt16 nPos = 0; nPos < maItems.size(); nPos++ )
{
GtkSalMenuItem *pSalItem = maItems[ nPos ];
if ( pSalItem->mpSubMenu != NULL )
{
pSalItem->mpSubMenu->ActivateAllSubmenus(pMenuBar);
pSalItem->mpSubMenu->Update();
}
}
}
void GtkSalMenu::Activate()
{
if ( mbMenuBar != TRUE )
return;
GtkSalMenu* pSalSubMenu = GetMenuForItemCommand( (gchar*) aMenuCommand, TRUE );
if ( pSalSubMenu != NULL ) {
MenuBar* pMenuBar = static_cast< MenuBar* >( mpVCLMenu );
pMenuBar->HandleMenuActivateEvent( pSalSubMenu->mpVCLMenu );
pSalSubMenu->Update();
}
ActivateAllSubmenus(static_cast<MenuBar*>(mpVCLMenu));
}
void GtkSalMenu::Deactivate( const gchar* aMenuCommand )
{
if ( mbMenuBar == sal_False )