Skip to content

LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust

MENU-BAR: a rebuilt native menu applies the keys' yield state in the same frame

Nathaniel Ledford7fc8161fc96f
diff --git a/apps/lightcraft/src/native_menu.rs b/apps/lightcraft/src/native_menu.rs
index a60354bd1..031976b23 100644
--- a/apps/lightcraft/src/native_menu.rs
+++ b/apps/lightcraft/src/native_menu.rs
@@ -478,8 +478,9 @@ impl NativeMenu {
}
let bar = menu_bar(app);
if structure_of(&bar) != self.structure {
+ // (no early return: a rebuild installs every accelerator and resets the state they were synced
+ // to, so the sync below runs in this same frame and no key reaches the menu in between)
self.rebuild(app);
- return quit;
}
fn walk(nodes: &[MenuNode], items: &mut HashMap<String, Item>) {
for n in nodes {