From 795f8e85f1598ce1c7f4a35e60db9df7e63b27ef Mon Sep 17 00:00:00 2001 From: arookieofc <2128194521@qq.com> Date: Sun, 1 Nov 2026 02:25:48 +0800 Subject: [PATCH] fix(windows): de-parent settings window on Windows so DWM paints its shadow An owned child (WS_POPUP) of a borderless parent gets no DWM shadow, leaving the frameless settings window flat against its project window. Ownership is already tracked by the settings- label (parent-close cleanup in on_window_event, menu modality), so make the settings window top-level on Windows; macOS and Linux keep the native parent link. --- src-tauri/src/windows.rs | 10 +++++++--- src/features/settings/window/bridge.ts | 6 ++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src-tauri/src/windows.rs b/src-tauri/src/windows.rs index b9d14c12..a47340ad 100644 --- a/src-tauri/src/windows.rs +++ b/src-tauri/src/windows.rs @@ -796,9 +796,13 @@ pub fn open_settings_window( #[cfg(target_os = "linux")] crate::linux_window_state::prepare(app, &mut config); let builder = WebviewWindowBuilder::from_config(app, &config); - // AppKit child windows can disappear when dragged to another display's Space. - // The settings label already tracks ownership and parent-close cleanup. - #[cfg(not(target_os = "macos"))] + // Windows: an owned child (WS_POPUP) of a borderless parent gets no DWM + // shadow, leaving the frameless settings window flat against its parent. + // Ownership is tracked by the `settings-` label instead + // (parent-close cleanup, menu modality), so only Linux keeps the native + // parent link. AppKit child windows can disappear when dragged to another + // display's Space, so macOS keeps it too. + #[cfg(target_os = "linux")] let builder = builder.and_then(|b| b.parent(&parent)); let window = builder .and_then(|b| dev_font_preferences(b).build()) diff --git a/src/features/settings/window/bridge.ts b/src/features/settings/window/bridge.ts index 3aa20209..e78722cf 100644 --- a/src/features/settings/window/bridge.ts +++ b/src/features/settings/window/bridge.ts @@ -1,8 +1,10 @@ /** * Settings window ↔ its project window. * - * Settings live in a native child window `settings-` (see - * src-tauri/src/windows.rs) that only runs the settings pages. The action + * Settings live in a separate window `settings-` (see + * src-tauri/src/windows.rs) that only runs the settings pages (a native + * child of the parent on macOS/Linux; top-level on Windows so DWM paints + * its shadow). The action * registry stays in the project window: it sends the settings window a * description of every action (Keymap page, links that run actions) and runs * the actions the settings window forwards.