Skip to content

Commit

Permalink
v0.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
SanicBTW committed Feb 18, 2024
1 parent d1d57de commit 594d19e
Show file tree
Hide file tree
Showing 6 changed files with 1,008 additions and 469 deletions.
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,25 @@ or with git for the latest potentially unstable updates.
haxelib git HxWebView https://github.com/SanicBTW/HxWebView.git
```

## Linux Usage
In order to use the library in Linux you must have `webkit2gtk` and `gtk3` installed in your system.

You can check [this](https://github.com/webview/webview?tab=readme-ov-file#linux-and-bsd) file to see the specific name libraries for your distro.

You MUST include `NO_PRECOMPILED_HEADERS` to your defines in order to compile without any error.

### Regarding embedding
With the current header file, you should be able to embed the WebView into an existing window in any platform but it requires using widgets.

As I currently don't know how to use widgets on Haxe, embedding is somewhat a difficult topic.

However I will keep looking for a way to do it and keep y'all updated.

### Usage examples
Check out the [examples folder](https://github.com/SanicBTW/HxWebView/tree/master/examples) for examples on how you can use these webview bindings, the examples are the same as the [official](https://github.com/webview/webview/tree/master/examples) ones.

### Licensing
`HxWebView` is made available via the [MIT](https://github.com/SanicBTW/HxWebView/blob/master/LICENSE) license, the same license as [webview](https://github.com/webview/webview/blob/master/LICENSE).
`HxWebView` is made available via the [MIT](https://github.com/SanicBTW/HxWebView/blob/master/LICENSE) license, the same license as [webview](https://github.com/webview/webview/blob/master/LICENSE).

---
Using [15/02](https://github.com/webview/webview/commit/c4833a42d30fecac6d8cbe5e4932dd4eed6bcab3) header file
4 changes: 2 additions & 2 deletions haxelib.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"license": "MIT",
"tags": ["haxe", "webview", "cpp", "binds", "bindings", "native", "desktop", "cross"],
"description": "Haxe cross-platform desktop bindings for webview.",
"version": "0.0.4",
"releasenote": "Lime support, HaxeFlixel example.",
"version": "0.0.5",
"releasenote": "Updated header file and cleaned some code.",
"contributors": ["SanicBTW", "Vortex"],
"classPath": "source",
"dependencies": {
Expand Down
14 changes: 14 additions & 0 deletions internal/WebViewHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,20 @@ Dynamic hx_webview_version()
return out;
}

// Fix for webview_get_native_handle
// Had to go with ints since I was breaking my head with the type of enum n shi (it was giving me ObjectPtr)
void *hx_get_native_handle(webview_t w, int kind)
{
switch (kind)
{
case 0: return webview_get_native_handle(w, WEBVIEW_NATIVE_HANDLE_KIND_UI_WINDOW);
case 1: return webview_get_native_handle(w, WEBVIEW_NATIVE_HANDLE_KIND_UI_WIDGET);
case 2: return webview_get_native_handle(w, WEBVIEW_NATIVE_HANDLE_KIND_BROWSER_CONTROLLER);
default: return nullptr;
}
return nullptr;
}

// Wrapper for webview_dispatch
using hxDispatchFunc = std::function<void(webview_t, Dynamic)>;

Expand Down
Loading

0 comments on commit 594d19e

Please sign in to comment.