Expand description
The key dispatcher: egui key events become chords, chords resolve through the keymap in the focus chain’s context (ADR 0007), and the keys that resolve are consumed before widgets see them, and so is what such a key sends while it is held.
A focused widget that reads keys itself
(crate::focus::reads_keys: a list’s or a grid’s arrows) gets them
before a global binding of theirs pressed without Ctrl or Alt: the
dispatcher names them in the context
(CONTEXT_WIDGET_KEYS),
and such a binding resolves nothing. Bindings scoped to the widget’s
surface, panel or window were declared for that place and go first.
While a text input owns the keyboard
(crate::focus::text_input_owns_keyboard: a text field has the
focus, or an open input such as a slider’s typed entry claimed it),
Escape and Enter without Ctrl or Alt are left to the input: they
resolve nothing and stay in the input. A host with a dispatcher of its
own should ask the same before it reads those keys.
On macOS the Command key counts as Ctrl in chords, so one keymap
serves every platform (as egui’s Modifiers::command).
Structs§
- Dispatch
- A command a key asked for.
- KeyDispatcher
- Turns key events into commands, keeping the chords of a shortcut in progress and a trace of each resolution.
Constants§
- TRACES
- How many traces the dispatcher keeps.
Functions§
- chord_
of - The chord of a key press.
- key_of
- The egui key and modifiers of a chord (for tests and display).
- left_
to_ input - Whether a key press is left to a text input that owns the keyboard: Escape and Enter, without Ctrl or Alt.