diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index 1e91f0d7e3..7e68e671df 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -783,7 +783,7 @@ fn footer_button( use craft::ui::buttons::Button; use craft::ui::contract::{Props as _, Show as _}; let real = !ui.is_sizing_pass() && !craft::ui::runtime::measure::active(ui.ctx()); - let (rect, _) = ui.allocate_exact_size(size, egui::Sense::hover()); + let _ = size; let shown = Button::new(crate::i18n::tr(label).to_string()) .id_salt(alias) .enabled(enabled) @@ -792,7 +792,7 @@ fn footer_button( } else { Variant::SECONDARY }) - .show_at(ui, rect); + .show(ui); if real { crate::widgets::register_response(alias, shown.response.rect, &shown.response); } diff --git a/crates/ui-egui/src/shortcuts.rs b/crates/ui-egui/src/shortcuts.rs index 9ab12fe079..b88a540b2d 100644 --- a/crates/ui-egui/src/shortcuts.rs +++ b/crates/ui-egui/src/shortcuts.rs @@ -415,6 +415,9 @@ pub fn handle(app: &mut LightcraftApp, ctx: &egui::Context) { /// pin toggle, see `handle`). fn pressed_commands(app: &LightcraftApp, ctx: &egui::Context) -> (Vec, Vec<(&'static str, serde_json::Value)>, bool) { let mut fire: Vec = Vec::new(); + // An Escape no framework component took reaches the app as the window's Cancel (the runtime keeps the raw key): + // the app's own Escape bindings (View ▸ Back and the like) read it there, last in the pass. + let window_escape = craft::ui::runtime::keys::with_window_intents(ctx, false, |w| w.take(craft::ui::runtime::keys::Intent::Cancel)); // shortcuts the native menu bar handles (it consumes those key presses itself) let native = |sc: &str| app.native_shortcuts.contains(sc); let mut aliased: Vec<(&'static str, serde_json::Value)> = Vec::new(); @@ -449,7 +452,7 @@ fn pressed_commands(app: &LightcraftApp, ctx: &egui::Context) -> (Vec, V && let Some((m, k)) = parse(sc) && !native(sc) && !(k == Key::Escape && popup_open) - && matches(i, m, k) + && (matches(i, m, k) || (window_escape && k == Key::Escape && m == Modifiers::NONE)) && let Some(id) = grid_key_command(keymap, grid, app.ui.fullscreen, b.id, (m, k)) { if id == "view.zoomToggle" && k == Key::Space { @@ -468,7 +471,7 @@ fn pressed_commands(app: &LightcraftApp, ctx: &egui::Context) -> (Vec, V && !(k == Key::Escape && popup_open) && !(k == Key::Space && space_repeat) && !taken.contains(&(m, k)) - && matches(i, m, k) + && (matches(i, m, k) || (window_escape && k == Key::Escape && m == Modifiers::NONE)) { aliased.push((id, serde_json::from_str(params).unwrap_or_default())); }