From 47d15fc8a1675af0044352aae1e08ba32a096325 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20S=C3=B6derstr=C3=B6m?= Date: Thu, 25 Jan 2024 21:28:39 +0100 Subject: [PATCH] fix: initialize linux wry webview In the wry 0.32 examples the linux webviews are initialized in a different way to render properly using tao::platform::unix::WindowExtUnix. Tested with Gnome 45.3 and Wayland. --- packages/desktop/src/webview.rs | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/packages/desktop/src/webview.rs b/packages/desktop/src/webview.rs index 168e5ff3c..700633234 100644 --- a/packages/desktop/src/webview.rs +++ b/packages/desktop/src/webview.rs @@ -91,7 +91,28 @@ impl WebviewInstance { } }; - let mut webview = WebViewBuilder::new(&window) + #[cfg(any( + target_os = "windows", + target_os = "macos", + target_os = "ios", + target_os = "android" + ))] + let mut webview = WebViewBuilder::new(&window); + + #[cfg(not(any( + target_os = "windows", + target_os = "macos", + target_os = "ios", + target_os = "android" + )))] + let mut webview = { + use tao::platform::unix::WindowExtUnix; + use wry::WebViewBuilderExtUnix; + let vbox = window.default_vbox().unwrap(); + WebViewBuilder::new_gtk(vbox) + }; + + webview = webview .with_transparent(cfg.window.window.transparent) .with_url("dioxus://index.html/") .unwrap()