ui/server/toolkit.c

changeset 981
1d47e71f26b6
parent 956
4cdfbfd2038d
child 982
9102a53c5385
--- a/ui/server/toolkit.c	Mon Dec 08 16:21:24 2025 +0100
+++ b/ui/server/toolkit.c	Mon Dec 08 18:11:54 2025 +0100
@@ -75,3 +75,24 @@
     }
     ui_queue_free(event_queue);
 }
+
+typedef struct CallMain {
+    UiServerEvent event;
+    ui_threadfunc func;
+    void *data;
+} CallMain;
+
+static void mainthr(UiServerEventData *event, void *userdata) {
+    CallMain *c = userdata;
+    if(c->func) {
+        c->func(c->data);
+    }
+    free(c);
+}
+
+void ui_call_mainthread(ui_threadfunc tf, void* td) {
+    CallMain *c = malloc(sizeof(CallMain));
+    c->func = tf;
+    c->data = td;
+    ui_queue_put(event_queue, c);
+}

mercurial