blob: 2242315c319bd325aa8a4361a8dc90b32277d403 [file] [log] [blame] [edit]
// 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.input2;
using fuchsia.ui.views;
/// Components may request this service from their namespace to
/// be notified of physical key events.
[Discoverable]
protocol Keyboard {
/// Set key event listener for the specified View.
SetListener(fuchsia.ui.views.ViewRef view_ref, KeyListener listener) -> ();
};
/// Client should implement this protocol to get notified of key events.
/// Returning HANDLED will stop event propagation to other clients.
/// This notification is triggered on the following conditions:
/// 1. Component is focused (ViewRef is on FocusChain)
/// 2. Parent Views get the event first, child views last
/// 3. Client returning HANDLED stops the propagation to subsequent clients
protocol KeyListener {
OnKeyEvent(KeyEvent event) -> (Status result);
};
/// Return type for clients key events listener.
enum Status {
HANDLED = 1;
NOT_HANDLED = 2;
};