Quellcode durchsuchen

fix(core): revert fix visibility change (#9246) (#9465)

* Revert "fix(windows): changing WebView visibility on hide/show/minimize (#9246)"

This reverts commit 5bd47b44673f74b1b4e8d704b7a95539915ede76.

* Change files

* change file

* Update revert-fix-visibility-change.md
Tony vor 1 Jahr
Ursprung
Commit
f22ea29986
2 geänderte Dateien mit 8 neuen und 26 gelöschten Zeilen
  1. 5 0
      .changes/revert-fix-visibility-change.md
  2. 3 26
      core/tauri-runtime-wry/src/lib.rs

+ 5 - 0
.changes/revert-fix-visibility-change.md

@@ -0,0 +1,5 @@
+---
+"tauri-runtime-wry": patch:bug
+---
+
+Revert the [fix](https://github.com/tauri-apps/tauri/pull/9246) for webview's visibility doesn't change with the app window on Windows as it caused white flashes on show/restore.

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

@@ -2699,16 +2699,8 @@ fn handle_user_message<T: UserEvent>(
           WindowMessage::Unmaximize => window.set_maximized(false),
           WindowMessage::Minimize => window.set_minimized(true),
           WindowMessage::Unminimize => window.set_minimized(false),
-          WindowMessage::Show => {
-            window.set_visible(true);
-            #[cfg(windows)]
-            let _ = set_webview_visibility(&webviews, !window.is_minimized());
-          }
-          WindowMessage::Hide => {
-            window.set_visible(false);
-            #[cfg(windows)]
-            let _ = set_webview_visibility(&webviews, false);
-          }
+          WindowMessage::Show => window.set_visible(true),
+          WindowMessage::Hide => window.set_visible(false),
           WindowMessage::Close => {
             panic!("cannot handle `WindowMessage::Close` on the main thread")
           }
@@ -3369,7 +3361,7 @@ fn handle_event_loop<T: UserEvent>(
               .map(|w| (w.inner.clone(), w.webviews.clone()))
             {
               let size = size.to_logical::<f32>(window.scale_factor());
-              for webview in &webviews {
+              for webview in webviews {
                 if let Some(b) = &*webview.bounds.lock().unwrap() {
                   if let Err(e) = webview.set_bounds(wry::Rect {
                     position: LogicalPosition::new(size.width * b.x_rate, size.height * b.y_rate)
@@ -3381,9 +3373,6 @@ fn handle_event_loop<T: UserEvent>(
                   }
                 }
               }
-              #[cfg(windows)]
-              let _ =
-                set_webview_visibility(&webviews, window.is_visible() && !window.is_minimized());
             }
           }
           _ => {}
@@ -4156,15 +4145,3 @@ fn clear_window_surface(
     let _ = buffer.present();
   }
 }
-
-#[cfg(windows)]
-fn set_webview_visibility(
-  webviews: &[WebviewWrapper],
-  is_visible: bool,
-) -> windows::core::Result<()> {
-  for webview in webviews {
-    let controller = webview.controller();
-    unsafe { controller.SetIsVisible(is_visible) }?;
-  }
-  Ok(())
-}