Flutter Engine
The Flutter Engine
|
#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... | |
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:
kind
being kFlutterKeyEventTypeDown
), zero or more repeat events, and one key up event, representing a physical key button being pressed, held, and released.physical
and logical
. Having different character
s is allowed.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 FlutterKeyEvent
s, 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.
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.
FlutterKeyEventDeviceType FlutterKeyEvent::device_type |
The source device for the key event.
Definition at line 1152 of file embedder.h.
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.
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.
size_t FlutterKeyEvent::struct_size |
The size of this struct. Must be sizeof(FlutterKeyEvent).
Definition at line 1112 of file embedder.h.
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.
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.
FlutterKeyEventType FlutterKeyEvent::type |
The event kind.
Definition at line 1118 of file embedder.h.