Thu, 11 Jun 2026 20:35:37 +0200
only init global menubar, when menus were created (Cocoa)
| ui/cocoa/AppDelegate.m | file | annotate | diff | comparison | revisions | |
| ui/cocoa/menu.m | file | annotate | diff | comparison | revisions |
--- a/ui/cocoa/AppDelegate.m Thu Jun 11 20:27:11 2026 +0200 +++ b/ui/cocoa/AppDelegate.m Thu Jun 11 20:35:37 2026 +0200 @@ -38,11 +38,8 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { NSLog(@"toolkit applicationDidFinishLaunching"); - ui_menu_init(); uic_application_startup(NULL); - // run ui_menu_init again, because it is possible, that the startup func - // added menus (which is probably true when using other language bindings) - // the menu init func can be called multiple times and is also called + // The menu init func can be called multiple times and is also called // when a new window is created // The only usecase for calling init here is, that an application might not // open a window on startup, but wants a working menubar
--- a/ui/cocoa/menu.m Thu Jun 11 20:27:11 2026 +0200 +++ b/ui/cocoa/menu.m Thu Jun 11 20:35:37 2026 +0200 @@ -189,15 +189,16 @@ static BOOL menu_is_initialized = NO; void ui_menu_init(void) { - if(menu_is_initialized) { + UiMenu *menus_begin = uic_get_menu_list(); + UiMenu *ls = menus_begin; + + if(menu_is_initialized || !ls) { return; } menu_is_initialized = YES; bindingItems = [[NSMutableArray alloc] init]; - UiMenu *menus_begin = uic_get_menu_list(); - UiMenu *ls = menus_begin; int index = 1; while(ls) { if(ls->item.type == UI_MENU) {