diff options
author | 2024-01-19 20:41:52 +0100 | |
---|---|---|
committer | 2024-01-19 20:41:52 +0100 | |
commit | 1781068e1c3a65551db1e832fdbaddba99124051 (patch) | |
tree | 60e0b3854cc0541712572fbb0e56f14435951ea9 /examples/events/src/main.rs | |
parent | 41dec5bd203ff5b1574a33a17d5f7358ae1beea2 (diff) | |
parent | 7ae7fcb89855002519bab752fd3686106ce448db (diff) | |
download | iced-1781068e1c3a65551db1e832fdbaddba99124051.tar.gz iced-1781068e1c3a65551db1e832fdbaddba99124051.tar.bz2 iced-1781068e1c3a65551db1e832fdbaddba99124051.zip |
Merge branch 'master' into remove-vertex-indexing
Diffstat (limited to 'examples/events/src/main.rs')
-rw-r--r-- | examples/events/src/main.rs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/examples/events/src/main.rs b/examples/events/src/main.rs index 32d0da2c..fc51ac4a 100644 --- a/examples/events/src/main.rs +++ b/examples/events/src/main.rs @@ -10,7 +10,10 @@ use iced::{ pub fn main() -> iced::Result { Events::run(Settings { - exit_on_close_request: false, + window: window::Settings { + exit_on_close_request: false, + ..window::Settings::default() + }, ..Settings::default() }) } @@ -54,8 +57,9 @@ impl Application for Events { Command::none() } Message::EventOccurred(event) => { - if let Event::Window(window::Event::CloseRequested) = event { - window::close() + if let Event::Window(id, window::Event::CloseRequested) = event + { + window::close(id) } else { Command::none() } @@ -65,7 +69,7 @@ impl Application for Events { Command::none() } - Message::Exit => window::close(), + Message::Exit => window::close(window::Id::MAIN), } } @@ -78,8 +82,7 @@ impl Application for Events { self.last .iter() .map(|event| text(format!("{event:?}")).size(40)) - .map(Element::from) - .collect(), + .map(Element::from), ); let toggle = checkbox( |