tree: 96604c4b63b27d2815fff21ca3c7161f84063513 [path history] [tgz]
  4. config/
  5. meta/
  6. src/
  7. tests/

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 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.