blob: a67ef301c9f82408e4d949a7b5c66199a596ccb9 [file] [log] [blame]
// 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;
};
/// Client should implement this protocol to get notified of shortcut activation.
protocol Listener {
OnShortcut(uint32 id) -> (bool handled);
};