blob: d2908055a7b78d852c46ed019a00911fe8d4932f [file] [log] [blame]
// Copyright 2020 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.input3;
using fuchsia.input;
using zx;
/// Type of the keyboard key input event.
enum KeyEventType {
/// Key is pressed down.
PRESSED = 1;
/// Key is released.
RELEASED = 2;
/// Key was pressed while the client wasn't able to receive it, e.g new device connected
/// with a key held down or before system was started.
/// Client should not handle this as a key press.
SYNC = 3;
/// Key was released while the client wasn't able to receive it, e.g device was disconnected
/// or focus lost.
/// Client should not handle this as a key release.
CANCEL = 4;
};
/// Keyboard event is generated to reflect key input.
table KeyEvent {
/// Time in nanoseconds when the event was recorded, in the `CLOCK_MONOTONIC` time base.
1: zx.time timestamp;
/// Type of event.
2: KeyEventType type;
/// Identifies the key ignoring modifiers, layout, prior key events, etc.
3: fuchsia.input.Key key;
/// Modifiers in effect at the time of the event.
/// Example:
/// CapsLock is off, user presses CapsLock, then A, then releases both.
/// Event sequence is as follows:
/// 1. type: Pressed, key: CapsLock, modifiers: None
/// 2. type: Pressed, key: A, modifiers: CapsLock
/// 3. type: Released, key: CapsLock, modifiers: CapsLock
/// 4. type: Released, key: A, modifiers: CapsLock
///
/// CapsLock is on, user presses CapsLock, then A, then releases both.
/// 1. type: Pressed, key: CapsLock, modifiers: CapsLock
/// 2. type: Pressed, key: A, modifiers: None
/// 3. type: Released, key: CapsLock, modifiers: None
/// 4. type: Released, key: A, modifiers: None
4: Modifiers modifiers;
};