fix(desktop): create windows transparent at build time for Mica effects

PR#50 called WebviewWindow::set_transparent, which does not exist in
Tauri 2.11 (Tauri 1 API). Moved .transparent(true) onto the two window
builders under cfg(windows); set_effects is stable and stays post-build.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
pull/3587/head
Tomas Dvorak 2 weeks ago
parent 72e0b557d2
commit 533fcad647

@ -722,6 +722,11 @@ fn show_drive_window_internal(app: &AppHandle, title: &str, url_path: &str) {
// avoid platform compositor artifacts while preserving Windows effects. // avoid platform compositor artifacts while preserving Windows effects.
let builder = builder.background_color(Color(255, 255, 255, 255)); let builder = builder.background_color(Color(255, 255, 255, 255));
// Windows Mica/Acrylic effects require the window to be created transparent
// (WebviewWindow has no post-build transparency switch in Tauri 2).
#[cfg(windows)]
let builder = builder.transparent(true);
// Platform-specific: title_bar_style and hidden_title are macOS-only // Platform-specific: title_bar_style and hidden_title are macOS-only
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
let builder = builder let builder = builder
@ -739,7 +744,6 @@ fn show_drive_window_internal(app: &AppHandle, title: &str, url_path: &str) {
#[cfg(windows)] #[cfg(windows)]
{ {
let _ = window.set_transparent(true);
let _ = window.set_effects(effects); let _ = window.set_effects(effects);
} }
@ -803,6 +807,11 @@ pub fn show_settings_window_impl(app: &AppHandle) {
// avoid platform compositor artifacts while preserving Windows effects. // avoid platform compositor artifacts while preserving Windows effects.
let builder = builder.background_color(Color(255, 255, 255, 255)); let builder = builder.background_color(Color(255, 255, 255, 255));
// Windows Mica/Acrylic effects require the window to be created transparent
// (WebviewWindow has no post-build transparency switch in Tauri 2).
#[cfg(windows)]
let builder = builder.transparent(true);
// Platform-specific: title_bar_style and hidden_title are macOS-only // Platform-specific: title_bar_style and hidden_title are macOS-only
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
let builder = builder let builder = builder
@ -820,7 +829,6 @@ pub fn show_settings_window_impl(app: &AppHandle) {
#[cfg(windows)] #[cfg(windows)]
{ {
let _ = window.set_transparent(true);
let _ = window.set_effects(effects); let _ = window.set_effects(effects);
} }

Loading…
Cancel
Save