Runtime: runtime::keys re-exports the types an app reads window intents with

This commit is contained in:
aiongg
2026-11-12 14:32:48 +00:00
parent 6c76c5c915
commit 43549ad9db
2 changed files with 4 additions and 2 deletions
+3 -1
View File
@@ -5,7 +5,7 @@
use crate::runtime::commands::FirePhase;
use crate::runtime::egui::input::Action;
use crate::runtime::frame::PerViewport;
use craft_behavior::{EditCommand, Intent, PartRef};
use craft_behavior::EditCommand;
use craft_keymap::{Chord, Key, KeyInput, Layout, Mods};
use egui::{Context, Id, Vec2, ViewportId};
use std::collections::HashMap;
@@ -24,6 +24,8 @@ pub use claims::claim;
pub(crate) use claims::hold_escape;
#[doc(hidden)]
pub use claims::take_claimed;
/// The types `Intents` reads and returns, for an app that reads the window's intents (`with_window_intents`).
pub use craft_behavior::{AccessRequest, Intent, MoveMods, NavMove, PartRef};
#[doc(hidden)]
pub use input::down;
pub(crate) use input::{input_hook, queue_nav, take_menu_keys, take_nav};
+1 -1
View File
@@ -163,7 +163,7 @@ An app with its own eframe `App` calls the hooks in `craft::ui::shell::embed`. `
| Close path | The runtime's window host owns the root window's close request. `embed::logic` asks the app through its closure, then hands the close to the platform quit where there is one (macOS). |
| Input pacing | One press per pass: extra presses in one frame wait for the next passes. A press outside an open framework menu closes the menu and goes no further. After an OS resize of the window, the held pointer is released. |
The window's keys are the ones the runtime routes to no component: an Escape or a plain Enter while no framework stop is focused, and the arrows' nudge. `with_window_intents` offers them to its closure while nothing has framework focus. The closure takes what it handles (`Intents::take(Intent::Cancel)`) and returns whether it took anything; the rest stays for later readers. A framework scope that ran earlier in the pass takes them first (an open dialog takes the Escape that closes it), so the app reads them last in its UI to see what no component took. App code that read `Key::Escape`, `Key::Tab`, F6 or F10 from egui while none of its own widgets had focus reads these intents and `FrameOutput::chrome_toggles` instead; its own focused widgets and popups keep reading Tab and Escape from egui.
The window's keys are the ones the runtime routes to no component: an Escape or a plain Enter while no framework stop is focused, and the arrows' nudge. `with_window_intents` offers them to its closure while nothing has framework focus. The closure takes what it handles (`Intents::take(Intent::Cancel)`; `Intent` and the other types `Intents` reads are in `ui::runtime::keys`) and returns whether it took anything; the rest stays for later readers. A framework scope that ran earlier in the pass takes them first (an open dialog takes the Escape that closes it), so the app reads them last in its UI to see what no component took. App code that read `Key::Escape`, `Key::Tab`, F6 or F10 from egui while none of its own widgets had focus reads these intents and `FrameOutput::chrome_toggles` instead; its own focused widgets and popups keep reading Tab and Escape from egui.
Framework dialogs the app keeps as values run on a `DialogHost`: the app calls `run(ui)` once per pass after its own UI and reads results with `take`.