From 99edab4b61d6d7e6bba534055da812ddbfa45a43 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Wed, 19 Jun 2024 16:24:58 +0800 Subject: [PATCH] hide docker from tao, this may fix https://github.com/rustdesk/rustdesk/issues/8399 --- Cargo.lock | 4 ++-- src/tray.rs | 13 ++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4cb4a0634..9b9101bb6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6127,7 +6127,7 @@ dependencies = [ [[package]] name = "tao" version = "0.25.0" -source = "git+https://github.com/rustdesk-org/tao?branch=dev#8a014cdb4dd20f35d64bf992374fa40263ee86a4" +source = "git+https://github.com/rustdesk-org/tao?branch=dev#288c219cb0527e509590c2b2d8e7072aa9feb2d3" dependencies = [ "bitflags 1.3.2", "cc", @@ -6167,7 +6167,7 @@ dependencies = [ [[package]] name = "tao-macros" version = "0.1.2" -source = "git+https://github.com/rustdesk-org/tao?branch=dev#8a014cdb4dd20f35d64bf992374fa40263ee86a4" +source = "git+https://github.com/rustdesk-org/tao?branch=dev#288c219cb0527e509590c2b2d8e7072aa9feb2d3" dependencies = [ "proc-macro2 1.0.79", "quote 1.0.35", diff --git a/src/tray.rs b/src/tray.rs index 567f43c83..8251d2505 100644 --- a/src/tray.rs +++ b/src/tray.rs @@ -41,7 +41,7 @@ pub fn make_tray() -> hbb_common::ResultType<()> { let icon = tray_icon::Icon::from_rgba(icon_rgba, icon_width, icon_height) .context("Failed to open icon")?; - let event_loop = EventLoopBuilder::new().build(); + let mut event_loop = EventLoopBuilder::new().build(); let tray_menu = Menu::new(); let quit_i = MenuItem::new(translate("Exit".to_owned()), true, None); @@ -77,7 +77,6 @@ pub fn make_tray() -> hbb_common::ResultType<()> { let tray_channel = TrayEvent::receiver(); #[cfg(windows)] let (ipc_sender, ipc_receiver) = std::sync::mpsc::channel::(); - let mut docker_hiden = false; let open_func = move || { if cfg!(not(feature = "flutter")) { @@ -110,12 +109,12 @@ pub fn make_tray() -> hbb_common::ResultType<()> { }); #[cfg(windows)] let mut last_click = std::time::Instant::now(); + #[cfg(target_os = "macos")] + { + use tao::platform::macos::EventLoopExtMacOS; + event_loop.set_activation_policy(tao::platform::macos::ActivationPolicy::Accessory); + } event_loop.run(move |_event, _, control_flow| { - if !docker_hiden { - #[cfg(target_os = "macos")] - crate::platform::macos::hide_dock(); - docker_hiden = true; - } *control_flow = ControlFlow::WaitUntil( std::time::Instant::now() + std::time::Duration::from_millis(100), );