This is the home of the shortcut handler binary.
The shortcut handler allows clients to register the keyboard shortcuts they are interested in. The clients register through fuchsia.ui.shortcut/Registry
.
The shortcut handler is notified of keyboard events, through fuchsia.ui.shortcut/Manager
. Typically it is the input pipeline that calls into this protocol.
If the shortcut manager notices a sequence of keys matching one of the clients' interests, it notifies the respective client.
The details of the shortcut API are available in the README.md for fuchsia.ui.shortcut
.
For efficiency reasons, the shortcut handler keeps focused_registries
, a list of all shortcut registries that match the currently pertinent focus chain.
This list is invalidated by:
fuchsia.ui.shortcut/Manager.HandleFocusChange
)fuchsia.ui.shortcut/Registry.Register
).It is obvious why (1) invalidates: a whole another set of handlers may now be armed after a focus goes elsewhere. It is not quite so obvious why (2) invalidates too. A client may register a shortcut after the focus chain update has been received. Not recomputing at registration time will break the focused registries invariant, as we'd have a registry with an armed ViewRef
that is not in focused_registries
.