# HG changeset patch # User Olaf Wintermann # Date 1781107470 -7200 # Node ID 92841501de203d21d27a58a9859b629f72f95114 # Parent 7b5ee7367b327ad78b5f938d42913c75b514e040 add separate app init func, that is called before startup, to improve menu initialization order on some platforms diff -r 7b5ee7367b32 -r 92841501de20 make/xcode/toolkit/toolkit.xcodeproj/project.pbxproj --- a/make/xcode/toolkit/toolkit.xcodeproj/project.pbxproj Tue Jun 09 18:50:13 2026 +0200 +++ b/make/xcode/toolkit/toolkit.xcodeproj/project.pbxproj Wed Jun 10 18:04:30 2026 +0200 @@ -77,8 +77,8 @@ ED3EDBE12F96B2100096E507 /* action.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = action.h; path = ../../../ui/cocoa/action.h; sourceTree = ""; }; ED3EDBF22F96B2F80096E507 /* action.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = action.h; path = ../../../ui/common/action.h; sourceTree = ""; }; ED3EDBF32F96B2F80096E507 /* action.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = action.c; path = ../../../ui/common/action.c; sourceTree = ""; }; - ED4AB28C2FD09446001B6C02 /* icons.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = icons.h; path = /Users/olaf/Projekte/toolkit/ui/common/icons.h; sourceTree = ""; }; - ED4AB28D2FD09446001B6C02 /* icons.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = icons.c; path = /Users/olaf/Projekte/toolkit/ui/common/icons.c; sourceTree = ""; }; + ED4AB28C2FD09446001B6C02 /* icons.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = icons.h; path = ../../../ui/common/icons.h; sourceTree = ""; }; + ED4AB28D2FD09446001B6C02 /* icons.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = icons.c; path = ../../../ui/common/icons.c; sourceTree = ""; }; ED52BFAE2D86FC5D00FD8BE5 /* text.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = text.h; path = ../../../ui/cocoa/text.h; sourceTree = ""; }; ED52BFAF2D86FC5D00FD8BE5 /* text.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = text.m; path = ../../../ui/cocoa/text.m; sourceTree = ""; }; ED6580AC2CFF122700F5402F /* toolkit.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = toolkit.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -158,7 +158,7 @@ ED6581522CFF3CA000F5402F /* range.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = range.h; path = ../../../ui/ui/range.h; sourceTree = ""; }; ED6581542CFF3CA000F5402F /* text.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = text.h; path = ../../../ui/ui/text.h; sourceTree = ""; }; ED6581552CFF3CA000F5402F /* toolbar.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = toolbar.h; path = ../../../ui/ui/toolbar.h; sourceTree = ""; }; - ED6581562CFF3CA000F5402F /* toolkit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = toolkit.h; path = /Users/olaf/Projekte/toolkit/ui/ui/toolkit.h; sourceTree = ""; }; + ED6581562CFF3CA000F5402F /* toolkit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = toolkit.h; path = ../../../ui/ui/toolkit.h; sourceTree = ""; }; ED6581582CFF3CA000F5402F /* ui.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ui.h; path = ../../../ui/ui/ui.h; sourceTree = ""; }; ED6581592CFF3CA000F5402F /* window.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = window.h; path = ../../../ui/ui/window.h; sourceTree = ""; }; ED65815A2CFF3EE900F5402F /* MainWindow.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = MainWindow.h; path = ../../../ui/cocoa/MainWindow.h; sourceTree = ""; }; diff -r 7b5ee7367b32 -r 92841501de20 ui/cocoa/AppDelegate.m --- a/ui/cocoa/AppDelegate.m Tue Jun 09 18:50:13 2026 +0200 +++ b/ui/cocoa/AppDelegate.m Wed Jun 10 18:04:30 2026 +0200 @@ -37,8 +37,9 @@ @implementation AppDelegate - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { + NSLog(@"toolkit applicationDidFinishLaunching"); + uic_application_init(NULL); ui_menu_init(); - NSLog(@"toolkit applicationDidFinishLaunching"); uic_application_startup(NULL); } diff -r 7b5ee7367b32 -r 92841501de20 ui/common/app.c --- a/ui/common/app.c Tue Jun 09 18:50:13 2026 +0200 +++ b/ui/common/app.c Wed Jun 10 18:04:30 2026 +0200 @@ -28,6 +28,8 @@ #include "app.h" +static ui_callback init_func; +static void *init_data; static ui_callback startup_func; static void *startup_data; static ui_callback newwindow_func; @@ -38,6 +40,11 @@ void *exit_data; +void ui_oninit(ui_callback f, void *userdata) { + init_func = f; + init_data = userdata; +} + void ui_onstartup(ui_callback f, void *userdata) { startup_func = f; startup_data = userdata; @@ -58,6 +65,11 @@ exit_data = userdata; } +void uic_application_init(UiEvent *event) { + if(init_func) { + init_func(event, init_data); + } +} void uic_application_startup(UiEvent *event) { if(startup_func) { diff -r 7b5ee7367b32 -r 92841501de20 ui/common/app.h --- a/ui/common/app.h Tue Jun 09 18:50:13 2026 +0200 +++ b/ui/common/app.h Wed Jun 10 18:04:30 2026 +0200 @@ -35,6 +35,7 @@ extern "C" { #endif +void uic_application_init(UiEvent *event); void uic_application_startup(UiEvent *event); void uic_application_newwindow(UiEvent *event); void uic_application_open(UiEvent *event);