mirror of
https://github.com/tauri-apps/web-view.git
synced 2026-02-04 10:21:17 +01:00
Rename wrapper functions to webview functions
This commit is contained in:
@@ -287,7 +287,7 @@ impl<'a, T> WebView<'a, T> {
|
||||
let user_data_ptr = Box::into_raw(user_data);
|
||||
|
||||
unsafe {
|
||||
let inner = wrapper_webview_new(
|
||||
let inner = webview_new(
|
||||
title.as_ptr(),
|
||||
url.as_ptr(),
|
||||
width,
|
||||
@@ -326,7 +326,7 @@ impl<'a, T> WebView<'a, T> {
|
||||
}
|
||||
|
||||
fn user_data_wrapper_ptr(&self) -> *mut UserData<'a, T> {
|
||||
unsafe { wrapper_webview_get_userdata(self.inner) as _ }
|
||||
unsafe { webview_get_user_data(self.inner) as _ }
|
||||
}
|
||||
|
||||
fn user_data_wrapper(&self) -> &UserData<'a, T> {
|
||||
@@ -460,7 +460,7 @@ impl<'a, T> WebView<'a, T> {
|
||||
|
||||
let user_data_ptr = self.user_data_wrapper_ptr();
|
||||
webview_exit(self.inner);
|
||||
wrapper_webview_free(self.inner);
|
||||
webview_free(self.inner);
|
||||
let user_data = *Box::from_raw(user_data_ptr);
|
||||
user_data.inner
|
||||
}
|
||||
|
||||
@@ -34,12 +34,12 @@ bitflags! {
|
||||
}
|
||||
|
||||
extern {
|
||||
pub fn wrapper_webview_free(this: *mut CWebView);
|
||||
pub fn wrapper_webview_new(title: *const c_char, url: *const c_char, width: c_int, height: c_int, resizable: c_int, debug: c_int, external_invoke_cb: Option<ErasedExternalInvokeFn>, userdata: *mut c_void) -> *mut CWebView;
|
||||
pub fn webview_free(this: *mut CWebView);
|
||||
pub fn webview_new(title: *const c_char, url: *const c_char, width: c_int, height: c_int, resizable: c_int, debug: c_int, external_invoke_cb: Option<ErasedExternalInvokeFn>, userdata: *mut c_void) -> *mut CWebView;
|
||||
pub fn webview_loop(this: *mut CWebView, blocking: c_int) -> c_int;
|
||||
pub fn webview_terminate(this: *mut CWebView);
|
||||
pub fn webview_exit(this: *mut CWebView);
|
||||
pub fn wrapper_webview_get_userdata(this: *mut CWebView) -> *mut c_void;
|
||||
pub fn webview_get_user_data(this: *mut CWebView) -> *mut c_void;
|
||||
pub fn webview_dispatch(this: *mut CWebView, f: Option<ErasedDispatchFn>, arg: *mut c_void);
|
||||
pub fn webview_eval(this: *mut CWebView, js: *const c_char) -> c_int;
|
||||
pub fn webview_inject_css(this: *mut CWebView, css: *const c_char) -> c_int;
|
||||
|
||||
@@ -43,9 +43,9 @@ WEBVIEW_API void webview_exit(webview_t w);
|
||||
WEBVIEW_API void webview_debug(const char *format, ...);
|
||||
WEBVIEW_API void webview_print_log(const char *s);
|
||||
|
||||
WEBVIEW_API void* wrapper_webview_get_userdata(webview_t w);
|
||||
WEBVIEW_API webview_t 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);
|
||||
WEBVIEW_API void wrapper_webview_free(webview_t w);
|
||||
WEBVIEW_API void* webview_get_user_data(webview_t w);
|
||||
WEBVIEW_API webview_t 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);
|
||||
WEBVIEW_API void webview_free(webview_t w);
|
||||
WEBVIEW_API void webview_destroy(webview_t w);
|
||||
|
||||
// TODO WEBVIEW_API void webview_navigate(webview_t w, const char* url);
|
||||
|
||||
@@ -24,16 +24,16 @@ struct cocoa_webview {
|
||||
void *userdata;
|
||||
};
|
||||
|
||||
WEBVIEW_API void wrapper_webview_free(webview_t w) {
|
||||
WEBVIEW_API void webview_free(webview_t w) {
|
||||
free(w);
|
||||
}
|
||||
|
||||
WEBVIEW_API void* wrapper_webview_get_userdata(webview_t w) {
|
||||
WEBVIEW_API void* webview_get_user_data(webview_t w) {
|
||||
struct cocoa_webview* wv = (struct cocoa_webview*)w;
|
||||
return wv->userdata;
|
||||
}
|
||||
|
||||
WEBVIEW_API webview_t 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) {
|
||||
WEBVIEW_API webview_t 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) {
|
||||
struct cocoa_webview* wv = (struct cocoa_webview*)calloc(1, sizeof(*wv));
|
||||
wv->width = width;
|
||||
wv->height = height;
|
||||
@@ -44,7 +44,7 @@ WEBVIEW_API webview_t wrapper_webview_new(const char* title, const char* url, in
|
||||
wv->external_invoke_cb = external_invoke_cb;
|
||||
wv->userdata = userdata;
|
||||
if (webview_init(wv) != 0) {
|
||||
wrapper_webview_free(wv);
|
||||
webview_free(wv);
|
||||
return NULL;
|
||||
}
|
||||
return wv;
|
||||
|
||||
@@ -848,12 +848,12 @@ WEBVIEW_API void webview_print_log(const char *s)
|
||||
// TODO
|
||||
}
|
||||
|
||||
WEBVIEW_API void* wrapper_webview_get_userdata(webview_t w)
|
||||
WEBVIEW_API void* webview_get_user_data(webview_t w)
|
||||
{
|
||||
return static_cast<webview::webview*>(w)->get_user_data();
|
||||
}
|
||||
|
||||
WEBVIEW_API webview_t 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)
|
||||
WEBVIEW_API webview_t 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)
|
||||
{
|
||||
auto w = new webview::webview(external_invoke_cb, title, width, height, resizable, debug);
|
||||
w->set_user_data(userdata);
|
||||
@@ -861,7 +861,7 @@ WEBVIEW_API webview_t wrapper_webview_new(const char* title, const char* url, in
|
||||
return w;
|
||||
}
|
||||
|
||||
WEBVIEW_API void wrapper_webview_free(webview_t w)
|
||||
WEBVIEW_API void webview_free(webview_t w)
|
||||
{
|
||||
delete static_cast<webview::webview*>(w);
|
||||
}
|
||||
|
||||
@@ -27,16 +27,16 @@ struct gtk_webview {
|
||||
void *userdata;
|
||||
};
|
||||
|
||||
WEBVIEW_API void wrapper_webview_free(webview_t w) {
|
||||
WEBVIEW_API void webview_free(webview_t w) {
|
||||
free(w);
|
||||
}
|
||||
|
||||
WEBVIEW_API void* wrapper_webview_get_userdata(webview_t w) {
|
||||
WEBVIEW_API void* webview_get_user_data(webview_t w) {
|
||||
struct gtk_webview *wv = (struct webview *)w;
|
||||
return wv->userdata;
|
||||
}
|
||||
|
||||
WEBVIEW_API webview_t 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) {
|
||||
WEBVIEW_API webview_t 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) {
|
||||
struct gtk_webview* w = (struct gtk_webview*)calloc(1, sizeof(*w));
|
||||
w->width = width;
|
||||
w->height = height;
|
||||
@@ -47,7 +47,7 @@ WEBVIEW_API webview_t wrapper_webview_new(const char* title, const char* url, in
|
||||
w->external_invoke_cb = external_invoke_cb;
|
||||
w->userdata = userdata;
|
||||
if (webview_init(w) != 0) {
|
||||
wrapper_webview_free(w);
|
||||
webview_free(w);
|
||||
return NULL;
|
||||
}
|
||||
return w;
|
||||
|
||||
@@ -34,16 +34,16 @@ struct mshtml_webview {
|
||||
|
||||
int webview_init(struct mshtml_webview *wv);
|
||||
|
||||
WEBVIEW_API void wrapper_webview_free(webview_t w) {
|
||||
WEBVIEW_API void webview_free(webview_t w) {
|
||||
free(w);
|
||||
}
|
||||
|
||||
WEBVIEW_API void* wrapper_webview_get_userdata(webview_t w) {
|
||||
WEBVIEW_API void* webview_get_user_data(webview_t w) {
|
||||
struct mshtml_webview* wv = (struct mshtml_webview*)w;
|
||||
return wv->userdata;
|
||||
}
|
||||
|
||||
WEBVIEW_API webview_t 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) {
|
||||
WEBVIEW_API webview_t 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) {
|
||||
struct mshtml_webview* wv = (struct mshtml_webview*)calloc(1, sizeof(*wv));
|
||||
wv->width = width;
|
||||
wv->height = height;
|
||||
@@ -54,7 +54,7 @@ WEBVIEW_API webview_t wrapper_webview_new(const char* title, const char* url, in
|
||||
wv->external_invoke_cb = external_invoke_cb;
|
||||
wv->userdata = userdata;
|
||||
if (webview_init(wv) != 0) {
|
||||
wrapper_webview_free(wv);
|
||||
webview_free(wv);
|
||||
return NULL;
|
||||
}
|
||||
return wv;
|
||||
|
||||
Reference in New Issue
Block a user