| // Copyright 2019 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| library fuchsia.ui.shortcut; |
| |
| using fuchsia.ui.input; |
| using fuchsia.ui.views; |
| |
| /// Service to receive and handle shortcut activations. |
| /// |
| /// Components may request this service from their namespace to |
| /// use shortcuts. |
| [Discoverable] |
| protocol Registry { |
| /// Set shortcut activation listener. |
| SetView(fuchsia.ui.views.ViewRef viewRef, Listener listener); |
| |
| /// Register new trigger for the listener. |
| RegisterShortcut(Shortcut shortcut); |
| }; |
| |
| /// Shortcut descriptor. |
| table Shortcut { |
| /// Client-generated identifier, to distinguish shortcuts triggered. |
| 1: uint32 id; |
| |
| /// Keys or locks to be activated for triggering the shortcut. |
| 2: fuchsia.ui.input.Modifiers modifiers; |
| |
| /// Optional: Key to be pressed to trigger the shortcut. |
| /// Omit for modifier-only shortcuts. |
| 3: fuchsia.ui.input.Key key; |
| |
| /// When this flag is set to true, the parent's shortcuts take priority |
| /// and are matched before those of its children. |
| /// Defaults to false. |
| 4: bool use_priority; |
| }; |
| |
| /// Client should implement this protocol to get notified of shortcut activation. |
| protocol Listener { |
| OnShortcut(uint32 id) -> (bool handled); |
| }; |