@@ -693,6 +693,14 @@ typedef enum {
693693/// released.
694694/// * All events throughout a key press sequence shall have the same `physical`
695695/// and `logical`. Having different `character`s is allowed.
696+ ///
697+ /// A `FlutterKeyEvent` with `physical` 0 and `logical` 0 is an empty event.
698+ /// This is the only case either `physical` or `logical` can be 0. An empty
699+ /// event must be sent if a key message should be converted to no
700+ /// `FlutterKeyEvent`s, for example, when a key down message is received for a
701+ /// key that has already been pressed according to the record. This is to ensure
702+ /// some `FlutterKeyEvent` arrives at the framework before raw key message.
703+ /// See https://github.com/flutter/flutter/issues/87230.
696704typedef struct {
697705 /// The size of this struct. Must be sizeof(FlutterKeyEvent).
698706 size_t struct_size ;
@@ -706,11 +714,17 @@ typedef struct {
706714 ///
707715 /// For the full definition and list of pre-defined physical keys, see
708716 /// `PhysicalKeyboardKey` from the framework.
717+ ///
718+ /// The only case that `physical` might be 0 is when this is an empty event.
719+ /// See `FlutterKeyEvent` for introduction.
709720 uint64_t physical ;
710721 /// The key ID for the logical key of this event.
711722 ///
712723 /// For the full definition and a list of pre-defined logical keys, see
713724 /// `LogicalKeyboardKey` from the framework.
725+ ///
726+ /// The only case that `logical` might be 0 is when this is an empty event.
727+ /// See `FlutterKeyEvent` for introduction.
714728 uint64_t logical ;
715729 /// Null-terminated character input from the event. Can be null. Ignored for
716730 /// up events.
0 commit comments