mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-11-28 12:27:16 +03:00
fix(tauri-runtime-wry): tray event listener not registered (#6270)
This commit is contained in:
parent
5ab78fcafa
commit
b9c303a0dc
6
.changes/fix-tray-events.md
Normal file
6
.changes/fix-tray-events.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
"tauri-runtime-wry": patch
|
||||
"tauri": patch
|
||||
---
|
||||
|
||||
Fixes tray events not being delivered.
|
@ -2647,14 +2647,18 @@ fn handle_user_message<T: UserEvent>(
|
||||
Message::Tray(tray_id, tray_message) => {
|
||||
let mut trays = system_tray_manager.trays.lock().unwrap();
|
||||
|
||||
if let TrayMessage::Create(tray, tx) = tray_message {
|
||||
if let TrayMessage::Create(mut tray, tx) = tray_message {
|
||||
let mut listeners = Vec::new();
|
||||
if let Some(l) = tray.on_event.take() {
|
||||
listeners.push(Arc::new(l));
|
||||
}
|
||||
match create_tray(WryTrayId(tray_id), tray, event_loop) {
|
||||
Ok((tray, items)) => {
|
||||
trays.insert(
|
||||
tray_id,
|
||||
TrayContext {
|
||||
tray: Arc::new(Mutex::new(Some(tray))),
|
||||
listeners: Default::default(),
|
||||
listeners: Arc::new(Mutex::new(listeners)),
|
||||
items: Arc::new(Mutex::new(items)),
|
||||
},
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user