Kaydet (Commit) 26d092b3 authored tarafından Bjoern Michaelsen's avatar Bjoern Michaelsen

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

Change-Id: I4f6e76347c5c9b5c67a09b8c3dcd1b1708e8e703
üst bffb03fb
...@@ -52,6 +52,7 @@ private: ...@@ -52,6 +52,7 @@ private:
GtkSalMenu* GetMenuForItemCommand( gchar* aCommand, gboolean bGetSubmenu ); GtkSalMenu* GetMenuForItemCommand( gchar* aCommand, gboolean bGetSubmenu );
void ImplUpdate( gboolean bRecurse ); void ImplUpdate( gboolean bRecurse );
void ActivateAllSubmenus(MenuBar* pMenuBar);
public: public:
GtkSalMenu( sal_Bool bMenuBar ); GtkSalMenu( sal_Bool bMenuBar );
...@@ -97,7 +98,7 @@ public: ...@@ -97,7 +98,7 @@ public:
void NativeSetAccelerator( unsigned nSection, unsigned nItemPos, const KeyCode& rKeyCode, const OUString& rKeyName ); void NativeSetAccelerator( unsigned nSection, unsigned nItemPos, const KeyCode& rKeyCode, const OUString& rKeyName );
void DispatchCommand( gint itemId, const gchar* aCommand ); void DispatchCommand( gint itemId, const gchar* aCommand );
void Activate( const gchar* aMenuCommand ); void Activate();
void Deactivate( const gchar* aMenuCommand ); void Deactivate( const gchar* aMenuCommand );
void Display( sal_Bool bVisible ); void Display( sal_Bool bVisible );
bool PrepUpdate(); bool PrepUpdate();
......
...@@ -167,20 +167,22 @@ g_lo_action_group_perform_submenu_action (GLOActionGroup *group, ...@@ -167,20 +167,22 @@ g_lo_action_group_perform_submenu_action (GLOActionGroup *group,
const gchar *action_name, const gchar *action_name,
GVariant *state) GVariant *state)
{ {
SAL_INFO("vcl.unity", "g_lo_action_group_perform_submenu_action on " << group);
GtkSalFrame* pFrame = group->priv->frame; GtkSalFrame* pFrame = group->priv->frame;
SAL_INFO("vcl.unity", "g_lo_action_group_perform_submenu_action on " << group << " for frame " << pFrame);
if (pFrame == NULL) if (pFrame == NULL)
return; return;
GtkSalMenu* pSalMenu = static_cast<GtkSalMenu*> (pFrame->GetMenu()); 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) { if (pSalMenu != NULL) {
gboolean bState = g_variant_get_boolean (state); gboolean bState = g_variant_get_boolean (state);
SAL_INFO("vcl.unity", "g_lo_action_group_perform_submenu_action on " << group << " to " << bState);
if (bState) if (bState)
pSalMenu->Activate (action_name); pSalMenu->Activate();
else else
pSalMenu->Deactivate (action_name); pSalMenu->Deactivate (action_name);
} }
...@@ -191,7 +193,6 @@ g_lo_action_group_change_state (GActionGroup *group, ...@@ -191,7 +193,6 @@ g_lo_action_group_change_state (GActionGroup *group,
const gchar *action_name, const gchar *action_name,
GVariant *value) GVariant *value)
{ {
SAL_INFO("vcl.unity", "g_lo_action_group_perform_submenu_action on " << group);
g_return_if_fail (value != NULL); g_return_if_fail (value != NULL);
g_variant_ref_sink (value); g_variant_ref_sink (value);
......
...@@ -353,10 +353,6 @@ void GtkSalMenu::ImplUpdate( gboolean bRecurse ) ...@@ -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)); 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->SetMenuModel( G_MENU_MODEL( pSubMenuModel ) );
pSubmenu->SetActionGroup( G_ACTION_GROUP( pActionGroup ) ); pSubmenu->SetActionGroup( G_ACTION_GROUP( pActionGroup ) );
pSubmenu->GetMenu()->Activate();
pSubmenu->GetMenu()->Deactivate();
pSubmenu->ImplUpdate( bRecurse ); pSubmenu->ImplUpdate( bRecurse );
} }
} }
...@@ -658,7 +654,6 @@ GtkSalMenu* GtkSalMenu::GetMenuForItemCommand( gchar* aCommand, gboolean bGetSub ...@@ -658,7 +654,6 @@ GtkSalMenu* GtkSalMenu::GetMenuForItemCommand( gchar* aCommand, gboolean bGetSub
{ {
SolarMutexGuard aGuard; SolarMutexGuard aGuard;
GtkSalMenu* pMenu = NULL; GtkSalMenu* pMenu = NULL;
for ( sal_uInt16 nPos = 0; nPos < maItems.size(); nPos++ ) for ( sal_uInt16 nPos = 0; nPos < maItems.size(); nPos++ )
{ {
GtkSalMenuItem *pSalItem = maItems[ nPos ]; GtkSalMenuItem *pSalItem = maItems[ nPos ];
...@@ -695,24 +690,31 @@ void GtkSalMenu::DispatchCommand( gint itemId, const gchar *aCommand ) ...@@ -695,24 +690,31 @@ void GtkSalMenu::DispatchCommand( gint itemId, const gchar *aCommand )
Menu* pSubMenu = ( pSalSubMenu != NULL ) ? pSalSubMenu->GetMenu() : NULL; Menu* pSubMenu = ( pSalSubMenu != NULL ) ? pSalSubMenu->GetMenu() : NULL;
MenuBar* pMenuBar = static_cast< MenuBar* >( mpVCLMenu ); MenuBar* pMenuBar = static_cast< MenuBar* >( mpVCLMenu );
pMenuBar->HandleMenuCommandEvent( pSubMenu, itemId ); 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 ) if ( mbMenuBar != TRUE )
return; return;
ActivateAllSubmenus(static_cast<MenuBar*>(mpVCLMenu));
GtkSalMenu* pSalSubMenu = GetMenuForItemCommand( (gchar*) aMenuCommand, TRUE );
if ( pSalSubMenu != NULL ) {
MenuBar* pMenuBar = static_cast< MenuBar* >( mpVCLMenu );
pMenuBar->HandleMenuActivateEvent( pSalSubMenu->mpVCLMenu );
pSalSubMenu->Update();
}
} }
void GtkSalMenu::Deactivate( const gchar* aMenuCommand ) void GtkSalMenu::Deactivate( const gchar* aMenuCommand )
{ {
if ( mbMenuBar == sal_False ) if ( mbMenuBar == sal_False )
......
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