Flutter Engine
The Flutter Engine
Public Attributes | List of all members
FlutterKeyEvent Struct Reference

#include <embedder.h>

Public Attributes

size_t struct_size
 The size of this struct. Must be sizeof(FlutterKeyEvent). More...
 
double timestamp
 
FlutterKeyEventType type
 The event kind. More...
 
uint64_t physical
 
uint64_t logical
 
const char * character
 
bool synthesized
 
FlutterKeyEventDeviceType device_type
 The source device for the key event. More...
 

Detailed Description

A structure to represent a key event.

Sending FlutterKeyEvent via FlutterEngineSendKeyEvent results in a corresponding FlutterKeyEvent to be dispatched in the framework. It is embedder's responsibility to ensure the regularity of sent events, since the framework only performs simple one-to-one mapping. The events must conform the following rules:

A FlutterKeyEvent with physical 0 and logical 0 is an empty event. This is the only case either physical or logical can be 0. An empty event must be sent if a key message should be converted to no FlutterKeyEvents, for example, when a key down message is received for a key that has already been pressed according to the record. This is to ensure some FlutterKeyEvent arrives at the framework before raw key message. See https://github.com/flutter/flutter/issues/87230.

Definition at line 1110 of file embedder.h.

Member Data Documentation

◆ character

const char* FlutterKeyEvent::character

Null-terminated character input from the event. Can be null. Ignored for up events.

Definition at line 1137 of file embedder.h.

◆ device_type

FlutterKeyEventDeviceType FlutterKeyEvent::device_type

The source device for the key event.

Definition at line 1152 of file embedder.h.

◆ logical

uint64_t FlutterKeyEvent::logical

The key ID for the logical key of this event.

For the full definition and a list of pre-defined logical keys, see LogicalKeyboardKey from the framework.

The only case that logical might be 0 is when this is an empty event. See FlutterKeyEvent for introduction.

Definition at line 1134 of file embedder.h.

◆ physical

uint64_t FlutterKeyEvent::physical

The USB HID code for the physical key of the event.

For the full definition and list of pre-defined physical keys, see PhysicalKeyboardKey from the framework.

The only case that physical might be 0 is when this is an empty event. See FlutterKeyEvent for introduction.

Definition at line 1126 of file embedder.h.

◆ struct_size

size_t FlutterKeyEvent::struct_size

The size of this struct. Must be sizeof(FlutterKeyEvent).

Definition at line 1112 of file embedder.h.

◆ synthesized

bool FlutterKeyEvent::synthesized

True if this event does not correspond to a native event.

The embedder is likely to skip events and/or construct new events that do not correspond to any native events in order to conform the regularity of events (as documented in FlutterKeyEvent). An example is when a key up is missed due to loss of window focus, on a platform that provides query to key pressing status, the embedder might realize that the key has been released at the next key event, and should construct a synthesized up event immediately before the actual event.

An event being synthesized means that the timestamp might greatly deviate from the actual time when the event occurs physically.

Definition at line 1150 of file embedder.h.

◆ timestamp

double FlutterKeyEvent::timestamp

The timestamp at which the key event was generated. The timestamp should be specified in microseconds and the clock should be the same as that used by FlutterEngineGetCurrentTime.

Definition at line 1116 of file embedder.h.

◆ type

FlutterKeyEventType FlutterKeyEvent::type

The event kind.

Definition at line 1118 of file embedder.h.


The documentation for this struct was generated from the following file: