Skip to content

Commit

Permalink
fix: build issues
Browse files Browse the repository at this point in the history
  • Loading branch information
twlite committed Oct 3, 2024
1 parent 111031a commit 0f57a2b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@
"useTabs": false
},
"packageManager": "[email protected]"
}
}
44 changes: 33 additions & 11 deletions src/browser_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ use tao::{
event_loop::EventLoop,
window::{Fullscreen, Icon, ProgressBarState, Window, WindowBuilder},
};
use wry::{http::Request, Rect, WebView, WebViewBuilder, WebViewBuilderExtWindows};
use wry::{http::Request, Rect, WebView, WebViewBuilder};

#[cfg(target_os = "windows")]
use tao::platform::windows::IconExtWindows;
// #[cfg(target_os = "windows")]
// use tao::platform::windows::IconExtWindows;

#[napi]
pub enum FullscreenType {
Expand Down Expand Up @@ -225,14 +225,34 @@ impl BrowserWindow {
webview = webview.with_hotkeys_zoom(hotkeys_zoom);
}

if let Some(theme) = options.theme {
let theme = match theme {
JsTheme::Light => wry::Theme::Light,
JsTheme::Dark => wry::Theme::Dark,
_ => wry::Theme::Auto,
};

webview = webview.with_theme(theme)
{
#[cfg(target_os = "windows")]
use wry::WebViewBuilderExtWindows;

#[cfg(any(target_os = "macos", target_os = "ios",))]
use wry::WebViewBuilderExtDarwin;

#[cfg(target_os = "android")]
use wry::WebViewBuilderExtAndroid;

#[cfg(any(
target_os = "linux",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd",
))]
use wry::WebViewBuilderExtUnix;

if let Some(theme) = options.theme {
let theme = match theme {
JsTheme::Light => wry::Theme::Light,
JsTheme::Dark => wry::Theme::Dark,
_ => wry::Theme::Auto,
};

webview = webview.with_theme(theme)
}
}

if let Some(user_agent) = options.user_agent {
Expand Down Expand Up @@ -501,6 +521,8 @@ impl BrowserWindow {
) -> Result<()> {
#[cfg(target_os = "windows")]
{
use tao::platform::windows::IconExtWindows;

let ico = match icon {
Either::A(bytes) => Icon::from_rgba(bytes, width, height),
Either::B(path) => Icon::from_path(&path, PhysicalSize::new(width, height).into()),
Expand Down

0 comments on commit 0f57a2b

Please sign in to comment.