Google is committed to advancing racial equity for Black communities. See how.

fuchsia.ui.input3

PROTOCOLS

Keyboard

Defined in fuchsia.ui.input3/keyboard.fidl

Components may request this service from their namespace to be notified of physical key events.

AddListener

Add a key event listener for the specified View. If multiple listeners are added, each will receive key events independently and should respond with a Status.

Request

NameType
view_ref fuchsia.ui.views/ViewRef
listener KeyboardListener

Response

NameType

KeyboardListener

Defined in fuchsia.ui.input3/keyboard.fidl

Client should implement this protocol to get notified of key events.

OnKeyEvent

Called when a key event takes place, such as key press or release. Protocol implementers must respond to acknowledge the event by returning Status in a timely manner, i.e. not introducing significant delays to the input pipeline (typically 10s of milliseconds). Returning NOT_HANDLED means the event will propagate to another client or listener. Clients that do not acknowledge their events will eventually be disconnected. Notification is only dispatched when the View is focused (ViewRef is on FocusChain). Parent Views receive the notification first, child Views last. Returning HANDLED will stop event propagation to other clients and listeners.

Request

NameType
event KeyEvent

Response

NameType
status KeyEventStatus

STRUCTS

ENUMS

KeyEventStatus

Type: uint32

Defined in fuchsia.ui.input3/keyboard.fidl

Return type for clients key events listener.

NameValueDescription
HANDLED 1

The key event was handled and its further propagation should be stopped.

NOT_HANDLED 2

The key event wasn't handled and should be delivered to other clients or listeners.

KeyEventType

Type: uint32

Defined in fuchsia.ui.input3/events.fidl

Type of the keyboard key input event.

NameValueDescription
PRESSED 1

Key is pressed down.

RELEASED 2

Key is released.

SYNC 3

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.

CANCEL 4

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.

PointerDeviceType

Type: uint32

Defined in fuchsia.ui.input3/pointer.fidl

A characterization of a device that issues pointer event streams.

NameValueDescription
TOUCH 1

A device intended for manipulation by direct contact over its surface.

PointerEventPhase

Type: uint32

Defined in fuchsia.ui.input3/pointer.fidl

The possible states of a pointer event stream's state machine.

A typical pointer will move through this state machine: ADD - CHANGE* - REMOVE

NameValueDescription
ADD 1

The device has started tracking the pointer.

CHANGE 2

The device has reported an update to the pointer state.

REMOVE 3

The device has stopped tracking the pointer.

CANCEL 4

The event stream is no longer available.

TABLES

KeyEvent

Defined in fuchsia.ui.input3/events.fidl

Keyboard event is generated to reflect key input.

OrdinalNameTypeDescription
1 timestamp zx/time

Time in nanoseconds when the event was recorded, in the CLOCK_MONOTONIC time base.

2 type KeyEventType

Type of event.

3 key fuchsia.input/Key

Identifies the key ignoring modifiers, layout, prior key events, etc.

4 modifiers Modifiers

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

BITS

Modifiers

Type: uint64

Defined in fuchsia.ui.input3/modifiers.fidl

Modifiers are special keys that modify the purpose or the function of other keys when used in combination with them.

NameValueDescription
CAPS_LOCK 1

Applies when the CAPS_LOCK modifier is locked.

NUM_LOCK 2

Applies when the NUM_LOCK modifier is locked.

SCROLL_LOCK 4

Applies when the SCROLL_LOCK modifier is locked.