From 20c5bb4944f0343cc78698a2082c9ad6ee64b6d6 Mon Sep 17 00:00:00 2001 From: xintaofei Date: Wed, 25 Mar 2026 23:42:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E8=AE=BE=E7=BD=AE=E7=AA=97?= =?UTF-8?q?=E5=8F=A3=E6=89=93=E5=BC=80=E6=97=B6=E5=BC=BA=E5=88=B6=E7=BD=AE?= =?UTF-8?q?=E9=A1=B6=E9=80=BB=E8=BE=91=EF=BC=8C=E4=BB=A5=E5=8F=8A=E5=8E=BB?= =?UTF-8?q?=E6=8E=89=E7=A6=81=E7=94=A8=E5=85=B6=E5=AE=83=E7=AA=97=E5=8F=A3?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src-tauri/src/commands/windows.rs | 35 +------------------------------ 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/src-tauri/src/commands/windows.rs b/src-tauri/src/commands/windows.rs index 721a461..79a98be 100644 --- a/src-tauri/src/commands/windows.rs +++ b/src-tauri/src/commands/windows.rs @@ -1,4 +1,4 @@ -use std::collections::{HashMap, HashSet}; +use std::collections::HashMap; use std::sync::Mutex; use tauri::{AppHandle, Manager, WebviewUrl, WebviewWindowBuilder}; @@ -9,7 +9,6 @@ use crate::models::FolderHistoryEntry; pub struct SettingsWindowState { owner_window_label: Mutex>, - disabled_windows: Mutex>, } pub struct CommitWindowState { @@ -57,7 +56,6 @@ impl SettingsWindowState { pub fn new() -> Self { Self { owner_window_label: Mutex::new(None), - disabled_windows: Mutex::new(HashSet::new()), } } @@ -73,19 +71,6 @@ impl SettingsWindowState { .ok() .and_then(|mut owner| owner.take()) } - - fn set_disabled_windows(&self, labels: HashSet) { - if let Ok(mut disabled) = self.disabled_windows.lock() { - *disabled = labels; - } - } - - fn take_disabled_windows(&self) -> HashSet { - self.disabled_windows - .lock() - .map(|mut disabled| std::mem::take(&mut *disabled)) - .unwrap_or_default() - } } impl CommitWindowState { @@ -339,25 +324,13 @@ pub async fn open_settings_window( .title("Settings") .inner_size(1080.0, 700.0) .min_inner_size(1080.0, 600.0) - .always_on_top(true) .center(); let settings_window = apply_platform_window_style(builder) .build() .map_err(|e| AppCommandError::window("Failed to open settings window", e.to_string()))?; ensure_windows_undecorated(&settings_window); - let mut disabled = HashSet::new(); - for (label, webview) in app.webview_windows() { - if label != "settings" { - webview.set_enabled(false).map_err(|e| { - AppCommandError::window("Failed to update window enabled state", e.to_string()) - })?; - disabled.insert(label); - } - } - state.set_owner(owner_label); - state.set_disabled_windows(disabled); settings_window .set_focus() .map_err(|e| AppCommandError::window("Failed to focus settings window", e.to_string()))?; @@ -365,12 +338,6 @@ pub async fn open_settings_window( } pub fn restore_windows_after_settings(app: &AppHandle, state: &SettingsWindowState) { - for label in state.take_disabled_windows() { - if let Some(window) = app.get_webview_window(&label) { - let _ = window.set_enabled(true); - } - } - if let Some(owner_label) = state.take_owner() { if let Some(window) = app.get_webview_window(&owner_label) { let _ = window.set_focus();