refactor: replace AppHandleManager with handle::Handle for macOS activation policy management

This commit is contained in:
Tunglies
2025-08-28 17:27:54 +08:00
parent 53688f332f
commit a9951e4eca
6 changed files with 72 additions and 143 deletions

View File

@@ -1,5 +1,3 @@
#[cfg(target_os = "macos")]
use crate::AppHandleManager;
use crate::{
config::{Config, PrfItem},
core::*,
@@ -185,9 +183,7 @@ pub async fn resolve_setup_async(app_handle: &AppHandle) {
#[cfg(target_os = "macos")]
{
if is_silent_start {
use crate::AppHandleManager;
AppHandleManager::global().set_activation_policy_accessory();
handle::Handle::global().set_activation_policy_accessory();
}
}
create_window(!is_silent_start).await;
@@ -273,9 +269,7 @@ pub async fn create_window(is_show: bool) -> bool {
let _ = window.set_focus();
#[cfg(target_os = "macos")]
{
AppHandleManager::global().set_activation_policy_regular();
}
handle::Handle::global().set_activation_policy_regular();
}
return true;
}
@@ -432,9 +426,7 @@ pub async fn create_window(is_show: bool) -> bool {
let _ = window_clone.set_focus();
logging!(info, Type::Window, true, "窗口已立即显示");
#[cfg(target_os = "macos")]
{
AppHandleManager::global().set_activation_policy_regular();
}
handle::Handle::global().set_activation_policy_regular();
let timeout_seconds = if crate::module::lightweight::is_in_lightweight_mode() {
3