Recursively call evaluate on submenus of conditional menus

There seems to be a bug with certain GTK setups that prevents the
submenus from getting sized correctly unless the elements are added
when the main menu is displayed.

Fixes: lp:1835460
* https://bugs.launchpad.net/kicad/+bug/1835460
This commit is contained in:
Ian McInerney 2019-08-02 10:40:19 +02:00 committed by Jeff Young
parent 5c85dbaec4
commit 05429bc39c
1 changed files with 12 additions and 0 deletions

View File

@ -197,6 +197,18 @@ void CONDITIONAL_MENU::Evaluate( SELECTION& aSelection )
menuItem->Enable( result );
}
}
// Recursively call Evaluate on all the submenus that are CONDITIONAL_MENUs to ensure
// they are updated. This is also required on GTK to make sure the menus have the proper
// size when created.
runOnSubmenus(
[&aSelection]( ACTION_MENU* aMenu )
{
CONDITIONAL_MENU* conditionalMenu = dynamic_cast<CONDITIONAL_MENU*>( aMenu );
if( conditionalMenu )
conditionalMenu->Evaluate( aSelection );
} );
}