Skip to content

Commit f22ea29

Browse files
fix(core): revert fix visibility change (#9246) (#9465)
* Revert "fix(windows): changing WebView visibility on hide/show/minimize (#9246)" This reverts commit 5bd47b4. * Change files * change file * Update revert-fix-visibility-change.md
1 parent f1674fc commit f22ea29

2 files changed

Lines changed: 8 additions & 26 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri-runtime-wry": patch:bug
3+
---
4+
5+
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.

core/tauri-runtime-wry/src/lib.rs

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2699,16 +2699,8 @@ fn handle_user_message<T: UserEvent>(
26992699
WindowMessage::Unmaximize => window.set_maximized(false),
27002700
WindowMessage::Minimize => window.set_minimized(true),
27012701
WindowMessage::Unminimize => window.set_minimized(false),
2702-
WindowMessage::Show => {
2703-
window.set_visible(true);
2704-
#[cfg(windows)]
2705-
let _ = set_webview_visibility(&webviews, !window.is_minimized());
2706-
}
2707-
WindowMessage::Hide => {
2708-
window.set_visible(false);
2709-
#[cfg(windows)]
2710-
let _ = set_webview_visibility(&webviews, false);
2711-
}
2702+
WindowMessage::Show => window.set_visible(true),
2703+
WindowMessage::Hide => window.set_visible(false),
27122704
WindowMessage::Close => {
27132705
panic!("cannot handle `WindowMessage::Close` on the main thread")
27142706
}
@@ -3369,7 +3361,7 @@ fn handle_event_loop<T: UserEvent>(
33693361
.map(|w| (w.inner.clone(), w.webviews.clone()))
33703362
{
33713363
let size = size.to_logical::<f32>(window.scale_factor());
3372-
for webview in &webviews {
3364+
for webview in webviews {
33733365
if let Some(b) = &*webview.bounds.lock().unwrap() {
33743366
if let Err(e) = webview.set_bounds(wry::Rect {
33753367
position: LogicalPosition::new(size.width * b.x_rate, size.height * b.y_rate)
@@ -3381,9 +3373,6 @@ fn handle_event_loop<T: UserEvent>(
33813373
}
33823374
}
33833375
}
3384-
#[cfg(windows)]
3385-
let _ =
3386-
set_webview_visibility(&webviews, window.is_visible() && !window.is_minimized());
33873376
}
33883377
}
33893378
_ => {}
@@ -4156,15 +4145,3 @@ fn clear_window_surface(
41564145
let _ = buffer.present();
41574146
}
41584147
}
4159-
4160-
#[cfg(windows)]
4161-
fn set_webview_visibility(
4162-
webviews: &[WebviewWrapper],
4163-
is_visible: bool,
4164-
) -> windows::core::Result<()> {
4165-
for webview in webviews {
4166-
let controller = webview.controller();
4167-
unsafe { controller.SetIsVisible(is_visible) }?;
4168-
}
4169-
Ok(())
4170-
}

0 commit comments

Comments
 (0)