diff --git a/crates/ui-egui/src/framework.rs b/crates/ui-egui/src/framework.rs index 7d7e999e..a7f69aeb 100644 --- a/crates/ui-egui/src/framework.rs +++ b/crates/ui-egui/src/framework.rs @@ -16,7 +16,7 @@ use craft_host::target::ShellInfo; use craft_host::{AppInfo, Host}; use craft_keymap::{Chord, Key, Overrides}; use craft_ui::fonts::{I18nScripts, SystemFonts, UiFonts}; -use craft_ui::runtime::commands::{CommandInput, CommandSet as _, NavCommand, QuitCommand}; +use craft_ui::runtime::commands::{CommandInput, CommandSet as _, NavCommand}; use craft_ui::runtime::env::{RootEnv, Scale}; use craft_ui::runtime::focus::{self, EditSet, FocusTarget, KeyUse}; use craft_ui::runtime::frame::{FrameInput, FrameOutput}; @@ -90,15 +90,14 @@ pub(crate) fn host() -> Arc { ) } -/// MaterialCraft quits with its own `ui.quit` (File > Exit, Ctrl+Q), which its shortcuts read from egui, so the -/// framework's `window.quit` is unbound. So are its F6 and Shift+F6 pane moves: Preferences > Shortcuts assigns any -/// chord to a node. Overrides are keyed by command id, which the command set gives. +/// Preferences > Shortcuts assigns any chord to a node, so the runtime's F6 and Shift+F6 pane moves are unbound. +/// Overrides are keyed by command id, which the command set gives. fn command_overrides() -> Arc { static OVERRIDES: OnceLock> = OnceLock::new(); OVERRIDES .get_or_init(|| { let mut overrides = Overrides::new(); - for id in [QuitCommand::Quit.id(), NavCommand::NextPane.id(), NavCommand::PreviousPane.id()] { + for id in [NavCommand::NextPane.id(), NavCommand::PreviousPane.id()] { overrides.insert(id, Vec::new()); } Arc::new(overrides) @@ -117,7 +116,7 @@ impl MaterialCraftApp { } /// The root values of this frame. MaterialCraft registers no commands with the runtime (it unbinds the framework's - /// quit and pane moves, [`command_overrides`]) and lets it toggle no chrome, so the output carries nothing it acts on. While one of MaterialCraft's own egui modals shows in the + /// pane moves, [`command_overrides`]) and lets it toggle no chrome, so the output carries nothing it acts on. While one of MaterialCraft's own egui modals shows in the /// root window, the runtime blocks the panels floated into windows of their own. pub(crate) fn frame_input(&mut self, ctx: &egui::Context, _output: FrameOutput, scale: f32) -> FrameInput { use crate::theme::Brightness; diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rs index 7c5a0ea7..2fa9f8a9 100644 --- a/crates/ui-egui/src/menus.rs +++ b/crates/ui-egui/src/menus.rs @@ -503,7 +503,13 @@ pub fn shortcuts(app: &mut MaterialCraftApp, ctx: &egui::Context) { app.dispatcher.dispatch_filtered(i, &app.keymap, |hit| { let id = hit.command.id.as_str(); let keeps_escape = id == "ui.cook.cancel" && (!app.cooker.busy() || gesture_in_progress || node_search_open || label_selected); - modality.allows(id) && !(label_selected && matches!(id, "edit.copy" | "edit.cut")) && !unavailable_clipboard_commands.contains(&id) && !keeps_escape + // The runtime's Quit runs Ctrl+Q, in the panels' own windows and from text fields too + let runtime_quits = id == "ui.quit"; + modality.allows(id) + && !runtime_quits + && !(label_selected && matches!(id, "edit.copy" | "edit.cut")) + && !unavailable_clipboard_commands.contains(&id) + && !keeps_escape }) }); for hit in hits {