fix: resolve macOS window management issues and improve logging during app reopen events

This commit is contained in:
Tunglies
2025-08-03 18:40:19 +08:00
Unverified
parent d16c691c0f
commit 109f5f9648
2 changed files with 32 additions and 4 deletions

View File

@@ -43,12 +43,15 @@
- 改进核心启动/停止/重启后的状态刷新机制
- 修复 `Windows` 安装器删除用户自启问题
- 修复 `Windows` 安装器参数使用错误问题
- 修复 `macOS` 下点击 `Dock` 图标无法恢复窗口显示的问题
- 修复 `IPC` 迁移后节点测速功能异常
- 修复 `IPC` 迁移后连接上下行速率计算功能异常
- 修复 `IPC` 迁移后内核日志(等级切换)功能异常
- 修复 `IPC` 迁移后内核日志功能异常
- 修复 `External-Controller-Cors` 无法保存所需前置条件
- 修复首页端口不一致问题
- 修复首页流量统计卡片重构后无法显示流量刻度线
- 修复日志页面启动/停止和清除按钮功能混淆,现在启动/停止按钮控制后端日志监控,清除按钮仅清理前端显示的日志
- 修复日志等级设置的持久化配置,首次加载时正确应用已保存的日志等级到后端
### 🔧 技术改进

View File

@@ -8,6 +8,8 @@ mod module;
mod process;
mod state;
mod utils;
#[cfg(target_os = "macos")]
use crate::utils::window_manager::WindowManager;
use crate::{
core::hotkey,
process::AsyncHandler,
@@ -498,10 +500,33 @@ pub fn run() {
/// Handle application reopen events (macOS)
#[cfg(target_os = "macos")]
pub fn handle_reopen(app_handle: &tauri::AppHandle, has_visible_windows: bool) {
if !has_visible_windows {
AppHandleManager::global().set_activation_policy_regular();
}
logging!(
info,
Type::System,
true,
"处理 macOS 应用重新打开事件: has_visible_windows={}",
has_visible_windows
);
AppHandleManager::global().init(app_handle.clone());
if !has_visible_windows {
// 当没有可见窗口时,设置为 regular 模式并显示主窗口
AppHandleManager::global().set_activation_policy_regular();
logging!(info, Type::System, true, "没有可见窗口,尝试显示主窗口");
let result = WindowManager::show_main_window();
logging!(
info,
Type::System,
true,
"窗口显示操作完成,结果: {:?}",
result
);
} else {
logging!(info, Type::System, true, "已有可见窗口,无需额外操作");
}
}
/// Handle window close requests