fix: resolve unexpected behavior during silent startup #3320, #3187

This commit is contained in:
Tunglies
2025-04-12 18:09:27 +08:00
parent 16381d1895
commit 6e6462742c
2 changed files with 8 additions and 11 deletions

View File

@@ -123,6 +123,11 @@ pub async fn resolve_reset_async() {
/// create main window
pub fn create_window(is_showup: bool) {
if !is_showup {
logging!(info, Type::Window, "Not to display create window");
return;
}
logging!(info, Type::Window, true, "Creating window");
let app_handle = handle::Handle::global().app_handle().unwrap();
@@ -196,17 +201,8 @@ pub fn create_window(is_showup: bool) {
match window {
Ok(window) => {
logging!(info, Type::Window, true, "Window created successfully");
if is_showup {
let _ = window.show();
let _ = window.set_focus();
} else {
let _ = window.hide();
#[cfg(target_os = "macos")]
AppHandleManager::global().set_activation_policy_accessory();
}
// 设置窗口状态监控,实时保存窗口位置和大小
// crate::feat::setup_window_state_monitor(&app_handle);
let _ = window.show();
let _ = window.set_focus();
// 标记前端UI已准备就绪向前端发送启动完成事件
let app_handle_clone = app_handle.clone();