Sun, 07 Dec 2025 12:12:02 +0100
use new common app funcs in cocoa
| ui/cocoa/toolkit.m | file | annotate | diff | comparison | revisions |
--- a/ui/cocoa/toolkit.m Sun Dec 07 12:09:04 2025 +0100 +++ b/ui/cocoa/toolkit.m Sun Dec 07 12:12:02 2025 +0100 @@ -33,6 +33,7 @@ #include "../common/menu.h" #include "../common/toolbar.h" #include "../common/threadpool.h" +#include "../common/app.h" #import "image.h" #import "menu.h" @@ -46,13 +47,6 @@ static int app_argc; static const char **app_argv; -static ui_callback startup_func; -static void *startup_data; -static ui_callback open_func; -static void *open_data; -static ui_callback exit_func; -static void *exit_data; - static UiBool exit_on_shutdown; /* ------------------- App Init / Event Loop functions ------------------- */ @@ -85,21 +79,6 @@ return application_name; } -void ui_onstartup(ui_callback f, void *userdata) { - startup_func = f; - startup_data = userdata; -} - -void ui_onopen(ui_callback f, void *userdata) { - open_func = f; - open_data = userdata; -} - -void ui_onexit(ui_callback f, void *userdata) { - exit_func = f; - exit_data = userdata; -} - void ui_app_exit_on_shutdown(UiBool exitapp) { exit_on_shutdown = exitapp; } @@ -111,9 +90,7 @@ e.document = NULL; e.eventdata = NULL; e.intval = 0; - if(startup_func) { - startup_func(&e, startup_data); - } + uic_application_startup(&e); } void ui_cocoa_onopen(const char *file) { @@ -123,9 +100,7 @@ e.document = NULL; e.eventdata = NULL; e.intval = 0; - if(open_func) { - open_func(&e, open_data); - } + uic_application_open(&e); } void ui_cocoa_onexit(void) { @@ -135,9 +110,7 @@ e.document = NULL; e.eventdata = NULL; e.intval = 0; - if(exit_func) { - exit_func(&e, exit_data); - } + uic_application_exit(&e); } void ui_main(void) {