--- a/ui/server/toolkit.c Sat Dec 06 14:12:11 2025 +0100 +++ b/ui/server/toolkit.c Sat Dec 06 15:24:13 2025 +0100 @@ -33,4 +33,49 @@ #include "toolkit.h" +#include "../common/message.h" +#include "../common/threadpool.h" +static const char *ui_app_name; + +static UiMessageHandler *message_handler; + +static ui_callback onstartup; +static void *onstartupdata; + +static UiQueue *event_queue; + +void ui_init(const char *appname, int argc, char **argv) { + ui_app_name = appname; + + message_handler = uic_simple_msg_handler(STDIN_FILENO, STDOUT_FILENO, ui_server_message_received); +} + +const char* ui_appname() { + return ui_app_name; +} + +void ui_onstartup(ui_callback f, void *userdata) { + onstartup = f; + onstartupdata = userdata; +} + +void ui_add_styledata(const char *styledata, int len) { + // NOOP +} + + +void ui_server_message_received(cxstring msg) { + +} + +void ui_main(void) { + event_queue = ui_queue_create(); + UiServerEvent *event = NULL; + while((event = ui_queue_get_wait(event_queue)) != NULL) { + if(event->callback) { + event->callback(&event->event, event->userdata); + } + } + ui_queue_free(event_queue); +}