This commit is contained in:
rustdesk 2024-06-19 16:24:58 +08:00
parent e50b72622c
commit 99edab4b61
2 changed files with 8 additions and 9 deletions

4
Cargo.lock generated
View File

@ -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",

View File

@ -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::<Data>();
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),
);