Return window::Id in window::open

This commit is contained in:
Héctor Ramón Jiménez 2024-07-30 22:26:55 +02:00
parent 8f33575719
commit fd593f8fb0
No known key found for this signature in database
GPG key ID: 4C07CEC81AFA161F
3 changed files with 17 additions and 10 deletions

View file

@ -40,12 +40,13 @@ enum Message {
impl Example {
fn new() -> (Self, Task<Message>) {
let (_id, open) = window::open(window::Settings::default());
(
Self {
windows: BTreeMap::new(),
},
window::open(window::Settings::default())
.map(Message::WindowOpened),
open.map(Message::WindowOpened),
)
}
@ -74,10 +75,12 @@ impl Example {
},
);
window::open(window::Settings {
let (_id, open) = window::open(window::Settings {
position,
..window::Settings::default()
})
});
open
})
.map(Message::WindowOpened)
}