Ver código fonte

fix(core): window transparency (#1800)

Lucas Fernandes Nogueira 4 anos atrás
pai
commit
f5a480fea3
2 arquivos alterados com 8 adições e 1 exclusões
  1. 5 0
      .changes/transparency-fix.md
  2. 3 1
      core/tauri-runtime-wry/src/lib.rs

+ 5 - 0
.changes/transparency-fix.md

@@ -0,0 +1,5 @@
+---
+"tauri-runtime-wry": patch
+---
+
+Fixes webview transparency.

+ 3 - 1
core/tauri-runtime-wry/src/lib.rs

@@ -1071,11 +1071,13 @@ fn create_webview<P: Params<Runtime = Wry>>(
     ..
   } = pending;
 
+  let is_window_transparent = window_builder.0.window.transparent;
   let window = window_builder.0.build(event_loop).unwrap();
   let mut webview_builder = WebViewBuilder::new(window)
     .map_err(|e| Error::CreateWebview(Box::new(e)))?
     .with_url(&url)
-    .unwrap(); // safe to unwrap because we validate the URL beforehand
+    .unwrap() // safe to unwrap because we validate the URL beforehand
+    .with_transparent(is_window_transparent);
   if let Some(handler) = rpc_handler {
     webview_builder =
       webview_builder.with_rpc_handler(create_rpc_handler(context.clone(), label.clone(), handler));