diff options
author | 2024-06-06 02:13:06 +0200 | |
---|---|---|
committer | 2024-06-10 22:03:46 +0200 | |
commit | ae2bf8ee40d1eb8f8176eae4541550fa2365f7a4 (patch) | |
tree | 94e359936d359e14d55ef7893a54476084e605fd | |
parent | e400f972c1fe6fa4f70f8cfe559ded680e6cf740 (diff) | |
download | iced-ae2bf8ee40d1eb8f8176eae4541550fa2365f7a4.tar.gz iced-ae2bf8ee40d1eb8f8176eae4541550fa2365f7a4.tar.bz2 iced-ae2bf8ee40d1eb8f8176eae4541550fa2365f7a4.zip |
Broadcast orphaned events in `multi_window` runtime
-rw-r--r-- | winit/src/multi_window.rs | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/winit/src/multi_window.rs b/winit/src/multi_window.rs index 3696f952..b4c30a20 100644 --- a/winit/src/multi_window.rs +++ b/winit/src/multi_window.rs @@ -491,7 +491,7 @@ async fn run_instance<A, E, C>( let mut clipboard = Clipboard::connect(&main_window.raw); let mut events = { vec![( - Some(window::Id::MAIN), + window::Id::MAIN, core::Event::Window(window::Event::Opened { position: main_window.position(), size: main_window.size(), @@ -561,7 +561,7 @@ async fn run_instance<A, E, C>( let _ = ui_caches.insert(id, user_interface::Cache::default()); events.push(( - Some(id), + id, core::Event::Window(window::Event::Opened { position: window.position(), size: window.size(), @@ -588,7 +588,7 @@ async fn run_instance<A, E, C>( use crate::core::event; events.push(( - None, + window::Id::MAIN, event::Event::PlatformSpecific( event::PlatformSpecific::MacOS( event::MacOS::ReceivedUrl(url), @@ -795,7 +795,7 @@ async fn run_instance<A, E, C>( let _ = ui_caches.remove(&id); events.push(( - None, + id, core::Event::Window(window::Event::Closed), )); @@ -814,7 +814,7 @@ async fn run_instance<A, E, C>( window.state.scale_factor(), window.state.modifiers(), ) { - events.push((Some(id), event)); + events.push((id, event)); } } } @@ -830,8 +830,7 @@ async fn run_instance<A, E, C>( let mut window_events = vec![]; events.retain(|(window_id, event)| { - if *window_id == Some(id) || window_id.is_none() - { + if *window_id == id { window_events.push(event.clone()); false } else { @@ -871,6 +870,14 @@ async fn run_instance<A, E, C>( } } + for (id, event) in events.drain(..) { + runtime.broadcast( + event, + core::event::Status::Ignored, + id, + ); + } + debug.event_processing_finished(); // TODO mw application update returns which window IDs to update |