- A chord is refused when the second layout group types a different key a
chord names at the level the grab uses (US with French: Ctrl+Q would also
take French Ctrl+A). Digits match at either level; groups 3 and 4 are not
checked.
- After registering, the mapping is read again. When the chord no longer
resolves to the grabbed hotkey and slot, the registration is refused and
its grab goes through the release path, which keeps the slots of current
entries and grabs again an entry a release removed.
- Presses queued for a refused hotkey id are dropped; releases stay.
- unregister returns an error when the chord's grab could not be released
and stays stuck.
- GlobalHotkeys::new documents that it must be the only user of
global-hotkey's events in the process.
`CommandDef::with_dispatch(Dispatch::App)` says the app runs a command from
its own key handling. The command keeps its catalog entry and its bindings,
so surfaces and the shortcut editor still show and list its chords, and the
keymap matches none of them: the lookup, the holders, conflicts and
assignment pass over it, and `shown_chord` shows its first single-press
binding, home scope first, which nothing here can shadow.
The default, `Dispatch::Keymap`, is what every def is today; a written
catalog leaves it out.
A keymap takes Delete and Backspace as one key by default (`DeleteKeys::OneKey`,
Photoshop's rule): a press runs its own key's binding, else the other key's.
`Keymap::with_delete_keys(DeleteKeys::Apart)` keeps them two keys, for an app
that gives them different jobs, and `Matcher` then runs only the pressed key's
binding.
When a keyboard layout change made a release remove another binding's
grab, that binding was grabbed again through a hotkey whose id could be
the one a leaving binding still had. The leaving binding stayed in the
set until unregister or replace finished, and events were matched to the
first binding with the id, so a press that came in between ran the
command that was being removed. A leaving binding is now marked retired
before the others are grabbed again, and events no longer go to it.
- A chord whose hotkey id a registered binding already uses on another key
is refused as a duplicate, in register and replace.
- A Latin letter in the second group is grabbed only on a key that types no
letter, digit or symbol in the first group; with US and French, Ctrl+A is
refused instead of grabbing the US Q key.
- When the keyboard mapping cannot be read, unregister, clear and an empty
replace keep the grabs for a later retry instead of releasing a key looked
up in a mapping that may have changed; unregister returns the error.
- When the layout changes while grabs are released, the stuck grabs are
tried once more in the new mapping, and a staying binding whose grab a
release removed is grabbed again, or leaves the set when it cannot be.
replace refuses every binding and leaves the set as it is when the X11
keyboard mapping cannot be read, so held chords keep working.
On X11 a removed chord whose key a layout change moved is released at
the key code it grabbed, through a hotkey that now leads there. A grab
no key leads to stays on a list that each later change retries, and its
hotkey is refused as Taken until then.
The core mapping is read as group 1, then group 2, then the AltGr
levels: with Russian and US, Ctrl+A grabs the key that types A, while
symbols outside group 1 levels 1 and 2 stay refused. A symbol the layout
types with Shift is bound as the keymap writes it (Ctrl+. on French
AZERTY grabs Ctrl+Shift), and Ctrl+Shift+. is refused.
On Windows the late release of a chord unregistered while held is
dropped, so it cannot end a newer hold of the same chord.
Windows reports AltGr as Ctrl+Alt, so a global Ctrl+Alt+E took the euro
sign from typing on German in every application. A Ctrl+Alt chord on a
letter, digit, symbol or Space key is now refused with the new
GlobalError::AltGr. The README lists the X11 and Windows refusals.
On French AZERTY . is Shift+; so Ctrl+Shift+. grabs that key with Shift.
A symbol at level 2 is now accepted when the chord holds Shift, and is
still refused without it.
global-hotkey's X11 backend grabs the first key code whose keysyms hold
the key's keysym. On German, Ctrl+[ therefore grabbed Ctrl+8, the key
that types [ with AltGr. A chord whose keysym that key types only at a
third or later level is now refused as Unbindable. Letters and digits
may be at level 2; other keys must be at level 1.
Two chords can also resolve to one key code and modifier set, such as
Ctrl+- and Ctrl+6 on French AZERTY. replace() and register() now refuse
the second one as Duplicate before it reaches the backend, so a failed
batch registration on X11 no longer unregisters the grab of a kept
binding while undoing the batch.
The `global` feature adds `global::GlobalHotkeys`, which registers chords
with the operating system through the global-hotkey crate:
RegisterHotKey on Windows, a Carbon hotkey on macOS and a key grab on
the X11 root window on Linux and the BSDs. `poll` returns each press and
release with the command it runs, so a hold such as push-to-talk has a
matching release.
- `replace` leaves unchanged bindings registered, registers new ones
in one request on X11 and reports each refused binding with its
reason (taken by another application, a typing key without a
modifier, a duplicate, more than 128).
- Wayland sessions, a missing X11 display, a stopped X11 key-grab
thread and unsupported systems fail in `new` instead of accepting
chords that never fire.
- Event queues are bounded; a dropped press goes with its release.
Mods::from_egui reads egui's modifiers for a platform, but nothing went the
other way: Chord::to_egui_shortcut leaves mac_cmd unset, so it does not give
the Modifiers egui-winit reports for a key press on macOS. A test harness or
remote control that types a chord into egui had to fold the platform itself.
Mods::to_egui(platform) sets mac_cmd and command for cmd on macOS, and ctrl
and command for cmd or ctrl elsewhere. A test converts all 16 combinations
both ways on each platform and checks that a press built from a chord
matches that chord.
- Dialogs: ButtonPlace { Foot, Side, Body } beside the port's refusal notice and
ChildDialog; every side_buttons caller (find, hyperlink, paragraph, list manager,
form dialogs) takes button_place, keeping the port's held answers, close buttons
and name check.
- Colour picker: upstream's fixed Full arrangement, CompareSwatch and warning module;
the port's shown_model and tabbed Colors dialog kept (its buttons stand in the side
column, the Full layout's in the picker's slot); the Compact layout shows the
compare block beside its area when the host gives a compare colour; focus_on_open
goes as upstream.
- Task bar: the grip is the bar's first member on one floating surface, for the task
kind only; the selection kind and the close reason stay.
- Keymap: lookup_where's accept filter runs through upstream's winners().
- craft-gpu: upstream's provider-neutral crate, with the port's eframe start-up
choices behind a startup feature (facade gpu-startup); duplicate facade row removed.
- Facade features, ATTRIBUTION, BMP density probe, margin story fit, theme icon-pack
and dialog first-field trials: both sides kept; the clipboard presence code stays
replaced by the port's offer modules.
The board asked the app's gate again for every resolution: each reader
of a command, the measuring and the real run of each component, and the
re-resolution of every shown reader at the start of each pass. The gate
is a snapshot of what the app knew before the frame, so the board keeps
its answers for the frame and asks once per command. CommandRef::key_text
gives the key without allocating for a command without parameters; the
keymap's lookups and the board's answers use it.
Keymap::shown_chord ran a lookup for each single-press binding of the
command, and Board::resolve calls it for every command it resolves, so
each frame repeated those lookups for every command row, tool and button.
The keymap works out each command's shown chord when it is built and
whenever its bindings change, and shown_chord reads the table. The lookup
and the table share one ranking (Keymap::winners), which replaces the
separate press_runs copy of it.
Two costs every frame paid, found in a profile of PhotoCraft on the
framework (storytold/photocraft#15493):
- `MenuBarUi::show` collected the Help search's entries (every row of
every menu, with English labels) on every pass whenever the bar had a
Help menu, open or not. `MenuHelp::built` takes a builder the bar runs
only in a pass that shows the Help menu; `MenuHelp::new` keeps taking a
ready list.
- `Keymap::shown_chord`, which every menu row, tooltip and button asks
each pass, built the command's key string for every `find` and ran a
full `lookup` per binding, cloning the winning commands only to look
their keys up again. `find` now looks up a command without parameters
by its id, and `press_runs` decides on catalog positions. Answers are
unchanged; a new test covers tools sharing a chord (a cycle within a
group, the first of two groups), which no test covered.
Measured in PhotoCraft (Windows 11, idle machine, three runs, together
with PhotoCraft's own storytold/photocraft#15496): UI pass with a pointer
over the canvas 8.7-11.3 ms -> 4.9-5.0 ms, during a menu hover
9.2-10.2 ms -> 6.7-7.1 ms.
Part of storytold/photocraft#15493.