mirror of https://github.com/tauri-apps/tauri
feat: add `DoubleClick` variant for `TrayIconEvent` (#10786)
* feat: add `DoubleClick` variant for `TrayIconEvent` * revert api example change --------- Co-authored-by: Lucas Nogueira <lucas@tauri.app>
This commit is contained in:
parent
3a4972b394
commit
1e441811ee
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"tauri": "patch:feat"
|
||||
---
|
||||
|
||||
On Windows, Add and emit `DoubleClick` variant for `TrayIconEvent`.
|
|
@ -4410,9 +4410,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tray-icon"
|
||||
version = "0.15.1"
|
||||
version = "0.16.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b92252d649d771105448969f2b2dda4342ba48b77731b60d37c93665e26615b"
|
||||
checksum = "131a65b2cef2081bc14dbcd414c906edbfa3bb5323dd7e748cc298614681196b"
|
||||
dependencies = [
|
||||
"core-graphics 0.24.0",
|
||||
"crossbeam-channel",
|
||||
|
|
|
@ -82,7 +82,7 @@ specta = { version = "^2.0.0-rc.16", optional = true, default-features = false,
|
|||
|
||||
[target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\", target_os = \"windows\", target_os = \"macos\"))".dependencies]
|
||||
muda = { version = "0.14", default-features = false, features = ["serde"] }
|
||||
tray-icon = { version = "0.15", default-features = false, features = ["serde"], optional = true }
|
||||
tray-icon = { version = "0.16", default-features = false, features = ["serde"], optional = true }
|
||||
|
||||
[target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies]
|
||||
gtk = { version = "0.18", features = ["v3_24"] }
|
||||
|
|
|
@ -91,6 +91,17 @@ pub enum TrayIconEvent {
|
|||
/// Mouse button state when this event was triggered.
|
||||
button_state: MouseButtonState,
|
||||
},
|
||||
/// A double click happened on the tray icon. **Windows Only**
|
||||
DoubleClick {
|
||||
/// Id of the tray icon which triggered this event.
|
||||
id: TrayIconId,
|
||||
/// Physical Position of this event.
|
||||
position: PhysicalPosition<f64>,
|
||||
/// Position and size of the tray icon.
|
||||
rect: Rect,
|
||||
/// Mouse button that triggered this event.
|
||||
button: MouseButton,
|
||||
},
|
||||
/// The mouse entered the tray icon region.
|
||||
Enter {
|
||||
/// Id of the tray icon which triggered this event.
|
||||
|
@ -125,6 +136,7 @@ impl TrayIconEvent {
|
|||
pub fn id(&self) -> &TrayIconId {
|
||||
match self {
|
||||
TrayIconEvent::Click { id, .. } => id,
|
||||
TrayIconEvent::DoubleClick { id, .. } => id,
|
||||
TrayIconEvent::Enter { id, .. } => id,
|
||||
TrayIconEvent::Move { id, .. } => id,
|
||||
TrayIconEvent::Leave { id, .. } => id,
|
||||
|
@ -151,6 +163,20 @@ impl From<tray_icon::TrayIconEvent> for TrayIconEvent {
|
|||
button: button.into(),
|
||||
button_state: button_state.into(),
|
||||
},
|
||||
tray_icon::TrayIconEvent::DoubleClick {
|
||||
id,
|
||||
position,
|
||||
rect,
|
||||
button,
|
||||
} => TrayIconEvent::DoubleClick {
|
||||
id,
|
||||
position,
|
||||
rect: Rect {
|
||||
position: rect.position.into(),
|
||||
size: rect.size.into(),
|
||||
},
|
||||
button: button.into(),
|
||||
},
|
||||
tray_icon::TrayIconEvent::Enter { id, position, rect } => TrayIconEvent::Enter {
|
||||
id,
|
||||
position,
|
||||
|
|
Loading…
Reference in New Issue