fn create_key_event(
    event: &keyboard_binding::KeyboardEvent,
    event_time: zx::Time,
) -> fidl_ui_input3::KeyEvent {
    let modifier_state: FrozenModifierState =
        event.get_modifiers().unwrap_or(Modifiers::from_bits_allow_unknown(0)).into();
    let lock_state: FrozenLockState =
        event.get_lock_state().unwrap_or(LockState::from_bits_allow_unknown(0)).into();
    fx_log_debug!(
        "ImeHandler::create_key_event: key:{:?}, modifier_state: {:?}, lock_state: {:?}, event_type: {:?}",
        event.get_key(),
        modifier_state,
        lock_state,
        event.get_event_type(),
    );
    // Don't override the key meaning if already set, e.g. by prior stage.
    let key_meaning = event.get_key_meaning().or(keymaps::US_QWERTY.apply(
        event.get_key(),
        &modifier_state,
        &lock_state,
    ));

    // Don't insert a spurious Some(0).
    let repeat_sequence = match event.get_repeat_sequence() {
        0 => None,
        s => Some(s),
    };

    fidl_ui_input3::KeyEvent {
        timestamp: Some(event_time.into_nanos()),
        type_: event.get_event_type().into(),
        key: event.get_key().into(),
        modifiers: event.get_modifiers(),
        lock_state: event.get_lock_state(),
        key_meaning,
        repeat_sequence,
        ..fidl_ui_input3::KeyEvent::EMPTY
    }
}
/// Returns a KeyEvent with the given parameters.
///
/// # Parameters
/// * `event`: The keyboard event to process.
/// * `event_time`: The time in nanoseconds when the event was first recorded.
Returns a KeyEvent with the given parameters.
Returns a KeyEvent with the given parameters .
fn create_key_event(
    event: &keyboard_binding::KeyboardEvent,
    event_time: zx::Time,
) -> fidl_ui_input3::KeyEvent {
    let modifier_state: FrozenModifierState =
        event.get_modifiers().unwrap_or(Modifiers::from_bits_allow_unknown(0)).into();
    let lock_state: FrozenLockState =
        event.get_lock_state().unwrap_or(LockState::from_bits_allow_unknown(0)).into();
    fx_log_debug!(
        "ImeHandler::create_key_event: key:{:?}, modifier_state: {:?}, lock_state: {:?}, event_type: {:?}",
        event.get_key(),
        modifier_state,
        lock_state,
        event.get_event_type(),
    );
    // Don't override the key meaning if already set, e.g. by prior stage.
    let key_meaning = event.get_key_meaning().or(keymaps::US_QWERTY.apply(
        event.get_key(),
        &modifier_state,
        &lock_state,
    ));
    // Don't insert a spurious Some(0).
    let repeat_sequence = match event.get_repeat_sequence() {
        0 => None,
        s => Some(s),
    };
    fidl_ui_input3::KeyEvent {
        timestamp: Some(event_time.into_nanos()),
        type_: event.get_event_type().into(),
        key: event.get_key().into(),
        modifiers: event.get_modifiers(),
        lock_state: event.get_lock_state(),
        key_meaning,
        repeat_sequence,
        ..fidl_ui_input3::KeyEvent::EMPTY
    }
}
fn create_key_event ( event : & keyboard_binding :: KeyboardEvent , event_time : zx :: Time , ) -> fidl_ui_input3 :: KeyEvent { let modifier_state : FrozenModifierState = event . get_modifiers ( ) . unwrap_or ( Modifiers :: from_bits_allow_unknown ( 0 ) ) . into ( ) ; let lock_state : FrozenLockState = event . get_lock_state ( ) . unwrap_or ( LockState :: from_bits_allow_unknown ( 0 ) ) . into ( ) ; fx_log_debug ! ( " " event get_key ( ) modifier_state lock_state event get_event_type ( ) ) ; // Don't override the key meaning if already set, e.g. by prior stage. let key_meaning = event . get_key_meaning ( ) . or ( keymaps :: US_QWERTY . apply ( event . get_key ( ) , & modifier_state , & lock_state , ) ) ; // Don't insert a spurious Some(0). let repeat_sequence = match event . get_repeat_sequence ( ) { 0 => None , s => Some ( s ) , } ; fidl_ui_input3 :: KeyEvent { timestamp : Some ( event_time . into_nanos ( ) ) , type_ : event . get_event_type ( ) . into ( ) , key : event . get_key ( ) . into ( ) , modifiers : event . get_modifiers ( ) , lock_state : event . get_lock_state ( ) , key_meaning , repeat_sequence , .. fidl_ui_input3 :: KeyEvent :: EMPTY } }
Returns a KeyEvent with the given parameters.
Returns a KeyEvent with the given parameters .
event
&keyboard_binding::KeyboardEvent
event_time
zx::Time
event
&keyboard_binding::KeyboardEvent
event_time
zx::Time