From dc86bd03733969033df7389c3d21e78ecc6291bb Mon Sep 17 00:00:00 2001 From: Richard Date: Wed, 27 Jul 2022 15:37:48 -0300 Subject: Introduce `close_requested` for `multi-window` --- winit/src/multi_window.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'winit/src/multi_window.rs') diff --git a/winit/src/multi_window.rs b/winit/src/multi_window.rs index 3c720a69..6fbedc55 100644 --- a/winit/src/multi_window.rs +++ b/winit/src/multi_window.rs @@ -147,6 +147,9 @@ where fn should_exit(&self) -> bool { false } + + /// TODO(derezzedex) + fn close_requested(&self, window: window::Id) -> Self::Message; } /// Runs an [`Application`] with an executor, compositor, and the provided @@ -296,7 +299,7 @@ async fn run_instance( >, init_command: Command, mut windows: HashMap, - exit_on_close_request: bool, + _exit_on_close_request: bool, ) where A: Application + 'static, E: Executor + 'static, @@ -684,9 +687,13 @@ async fn run_instance( if requests_exit( &window_event, window_state.state.modifiers(), - ) && exit_on_close_request - { - break; + ) { + if let Some(id) = + window_ids.get(&window_id).cloned() + { + let message = application.close_requested(id); + messages.push(message); + } } window_state.state.update( -- cgit