From e5f9742a27a77a0ab3ceee854fba2d139be232e0 Mon Sep 17 00:00:00 2001 From: James58899 Date: Wed, 29 May 2024 03:05:27 +0800 Subject: [PATCH] Fix windows build --- src/main.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index ecf818c..12b5b1f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -447,7 +447,7 @@ fn build_tray_icon() { }; use tray_icon::{ menu::{Menu, MenuEvent}, - ClickType, TrayIconBuilder, TrayIconEvent, + MouseButton, MouseButtonState, TrayIconBuilder, TrayIconEvent, }; // Show console @@ -470,8 +470,15 @@ fn build_tray_icon() { event_loop.run(move |_event, _, control_flow| { *control_flow = ControlFlow::WaitUntil((Instant::now() + Duration::from_millis(100)).into()); - if let Ok(event) = tray_channel.try_recv() { - if event.click_type == ClickType::Double { + if let Ok(TrayIconEvent::Click { + id: _, + position: _, + rect: _, + button, + button_state, + }) = tray_channel.try_recv() + { + if button == MouseButton::Left && button_state == MouseButtonState::Up { console_hide = !console_hide; switch_window(console_hide) }