tree: 62e8dfed14295753f4e7228d4a2e61a5e6a2bcae [path history] [tgz]
  1. config/
  2. meta/
  3. src/
  4. tests/
  5. BUILD.gn
  6. README.md
src/ui/bin/shortcut/README.md

Shortcut handler

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.

Implementation notes

Correct handling of registration events and focus changes

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:

  1. A focus chain change (someone calls fuchsia.ui.shortcut/Manager.HandleFocusChange)
  2. A registration of a new shortcut client (someone calls 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.