Fix widget operations in multi_window runtime

This commit is contained in:
Héctor Ramón Jiménez 2024-06-07 01:59:17 +02:00
parent ae2bf8ee40
commit 83296a73eb
No known key found for this signature in database
GPG key ID: 4C07CEC81AFA161F

View file

@ -1272,28 +1272,23 @@ fn run_command<A, C, E>(
std::mem::take(ui_caches), std::mem::take(ui_caches),
); );
'operate: while let Some(mut operation) = while let Some(mut operation) = current_operation.take() {
current_operation.take()
{
for (id, ui) in uis.iter_mut() { for (id, ui) in uis.iter_mut() {
if let Some(window) = window_manager.get_mut(*id) { if let Some(window) = window_manager.get_mut(*id) {
ui.operate(&window.renderer, operation.as_mut()); ui.operate(&window.renderer, operation.as_mut());
}
}
match operation.finish() { match operation.finish() {
operation::Outcome::None => {} operation::Outcome::None => {}
operation::Outcome::Some(message) => { operation::Outcome::Some(message) => {
proxy.send(message); proxy.send(message);
// operation completed, don't need to try to operate on rest of UIs
break 'operate;
} }
operation::Outcome::Chain(next) => { operation::Outcome::Chain(next) => {
current_operation = Some(next); current_operation = Some(next);
} }
} }
} }
}
}
*ui_caches = *ui_caches =
uis.drain().map(|(id, ui)| (id, ui.into_cache())).collect(); uis.drain().map(|(id, ui)| (id, ui.into_cache())).collect();