tauri.c 718 B

12345678910111213141516171819202122232425262728
  1. #define WEBVIEW_IMPLEMENTATION
  2. #include "tauri.h"
  3. void wrapper_webview_free(struct webview* w) {
  4. free(w);
  5. }
  6. struct webview* wrapper_webview_new(const char* title, const char* url, int width, int height, int resizable, int debug, webview_external_invoke_cb_t external_invoke_cb, void* userdata) {
  7. struct webview* w = (struct webview*)calloc(1, sizeof(*w));
  8. w->width = width;
  9. w->height = height;
  10. w->title = title;
  11. w->url = url;
  12. w->resizable = resizable;
  13. w->debug = debug;
  14. w->external_invoke_cb = external_invoke_cb;
  15. w->userdata = userdata;
  16. if (webview_init(w) != 0) {
  17. wrapper_webview_free(w);
  18. return NULL;
  19. }
  20. return w;
  21. }
  22. void* wrapper_webview_get_userdata(struct webview* w) {
  23. return w->userdata;
  24. }