mirror of
https://github.com/likelovewant/ollama-for-amd.git
synced 2025-12-24 07:28:27 +00:00
app: add code for macOS and Windows apps under 'app' (#12933)
* app: add code for macOS and Windows apps under 'app' * app: add readme * app: windows and linux only for now * ci: fix ui CI validation --------- Co-authored-by: jmorganca <jmorganca@gmail.com>
This commit is contained in:
36
app/webview/glue.c
Normal file
36
app/webview/glue.c
Normal file
@@ -0,0 +1,36 @@
|
||||
#include "webview.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
struct binding_context {
|
||||
webview_t w;
|
||||
uintptr_t index;
|
||||
};
|
||||
|
||||
void _webviewDispatchGoCallback(void *);
|
||||
void _webviewBindingGoCallback(webview_t, char *, char *, uintptr_t);
|
||||
|
||||
static void _webview_dispatch_cb(webview_t w, void *arg) {
|
||||
_webviewDispatchGoCallback(arg);
|
||||
}
|
||||
|
||||
static void _webview_binding_cb(const char *id, const char *req, void *arg) {
|
||||
struct binding_context *ctx = (struct binding_context *) arg;
|
||||
_webviewBindingGoCallback(ctx->w, (char *)id, (char *)req, ctx->index);
|
||||
}
|
||||
|
||||
void CgoWebViewDispatch(webview_t w, uintptr_t arg) {
|
||||
webview_dispatch(w, _webview_dispatch_cb, (void *)arg);
|
||||
}
|
||||
|
||||
void CgoWebViewBind(webview_t w, const char *name, uintptr_t index) {
|
||||
struct binding_context *ctx = calloc(1, sizeof(struct binding_context));
|
||||
ctx->w = w;
|
||||
ctx->index = index;
|
||||
webview_bind(w, name, _webview_binding_cb, (void *)ctx);
|
||||
}
|
||||
|
||||
void CgoWebViewUnbind(webview_t w, const char *name) {
|
||||
webview_unbind(w, name);
|
||||
}
|
||||
Reference in New Issue
Block a user