parent
2116fec20b
commit
25d0ced8ba
@ -58,7 +58,7 @@ tokio-native-tls ="0.3"
|
|||||||
protobuf-codegen = { version = "3.4" }
|
protobuf-codegen = { version = "3.4" }
|
||||||
|
|
||||||
[target.'cfg(target_os = "windows")'.dependencies]
|
[target.'cfg(target_os = "windows")'.dependencies]
|
||||||
winapi = { version = "0.3", features = ["winuser", "synchapi", "pdh", "memoryapi"] }
|
winapi = { version = "0.3", features = ["winuser", "synchapi", "pdh", "memoryapi", "sysinfoapi"] }
|
||||||
|
|
||||||
[target.'cfg(target_os = "macos")'.dependencies]
|
[target.'cfg(target_os = "macos")'.dependencies]
|
||||||
osascript = "0.3"
|
osascript = "0.3"
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
use std::{
|
use std::{
|
||||||
collections::VecDeque,
|
collections::VecDeque,
|
||||||
os::windows::raw::HANDLE,
|
|
||||||
sync::{Arc, Mutex},
|
sync::{Arc, Mutex},
|
||||||
time::Instant,
|
time::Instant,
|
||||||
};
|
};
|
||||||
@ -17,7 +16,7 @@ use winapi::{
|
|||||||
sysinfoapi::VerSetConditionMask,
|
sysinfoapi::VerSetConditionMask,
|
||||||
winbase::{VerifyVersionInfoW, INFINITE, WAIT_OBJECT_0},
|
winbase::{VerifyVersionInfoW, INFINITE, WAIT_OBJECT_0},
|
||||||
winnt::{
|
winnt::{
|
||||||
OSVERSIONINFOEXW, VER_BUILDNUMBER, VER_GREATER_EQUAL, VER_MAJORVERSION,
|
HANDLE, OSVERSIONINFOEXW, VER_BUILDNUMBER, VER_GREATER_EQUAL, VER_MAJORVERSION,
|
||||||
VER_MINORVERSION, VER_SERVICEPACKMAJOR, VER_SERVICEPACKMINOR,
|
VER_MINORVERSION, VER_SERVICEPACKMAJOR, VER_SERVICEPACKMINOR,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
23
src/tray.rs
23
src/tray.rs
@ -137,14 +137,23 @@ pub fn make_tray() -> hbb_common::ResultType<()> {
|
|||||||
|
|
||||||
if let Ok(_event) = tray_channel.try_recv() {
|
if let Ok(_event) = tray_channel.try_recv() {
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
if _event.click_type == tray_icon::ClickType::Left
|
match _event {
|
||||||
|| _event.click_type == tray_icon::ClickType::Double
|
TrayEvent::Click {
|
||||||
{
|
button,
|
||||||
if last_click.elapsed() < std::time::Duration::from_secs(1) {
|
button_state,
|
||||||
return;
|
..
|
||||||
|
} => {
|
||||||
|
if button == tray_icon::MouseButton::Left
|
||||||
|
&& button_state == tray_icon::MouseButtonState::Up
|
||||||
|
{
|
||||||
|
if last_click.elapsed() < std::time::Duration::from_secs(1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
open_func();
|
||||||
|
last_click = std::time::Instant::now();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
open_func();
|
_ => {}
|
||||||
last_click = std::time::Instant::now();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user