Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ crate-type = ["cdylib"]
[dependencies]
napi = { version = "3.8.2", default-features = true, features = ["napi9"] }
napi-derive = "3.5.1"
tao = "0.34.5"
tao = { version = "0.34.5", features = ["rwh_06"] }
wry = { version = "0.53.5", features = ["devtools", "fullscreen"] }

[target.'cfg(target_os = "linux")'.dependencies]
gtk = "0.18"
glib = "0.18"

[build-dependencies]
napi-build = "2"

Expand Down
32 changes: 16 additions & 16 deletions src/webview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ use napi_derive::*;
use tao::dpi::{LogicalPosition, LogicalSize};
use wry::{http::Request, Rect, WebViewBuilder};

#[cfg(target_os = "linux")]
use tao::platform::unix::WindowExtUnix;
#[cfg(target_os = "linux")]
use wry::WebViewBuilderExtUnix;

use crate::{HeaderData, IpcMessage};

/// Represents the theme of the window.
Expand Down Expand Up @@ -215,25 +220,20 @@ impl JsWebview {
)
};

#[cfg(not(target_os = "linux"))]
let webview = {
if options.child.unwrap_or(false) {
webview.build_as_child(&window).map_err(handle_build_error)
} else {
webview.build(&window).map_err(handle_build_error)
#[cfg(target_os = "linux")]
{
webview.build_gtk(window.default_vbox().unwrap()).map_err(handle_build_error)
}
}?;

#[cfg(target_os = "linux")]
let webview = {
if options.child.unwrap_or(false) {
webview
.build_as_child(&window)
.map_err(handle_build_error)?
} else {
webview.build(&window).map_err(handle_build_error)?
#[cfg(not(target_os = "linux"))]
{
if options.child.unwrap_or(false) {
webview.build_as_child(window).map_err(handle_build_error)
} else {
webview.build(window).map_err(handle_build_error)
}
}
};
}?;

Ok(Self {
webview_inner: webview,
Expand Down