pub struct KeyEvent {
pub timestamp: Option<i64>,
pub type_: Option<KeyEventType>,
pub key: Option<Key>,
pub modifiers: Option<Modifiers>,
pub key_meaning: Option<KeyMeaning>,
pub repeat_sequence: Option<u32>,
pub lock_state: Option<LockState>,
pub device_id: Option<u32>,
/* private fields */
}
Expand description
A Keyboard event generated to reflect key input. timestamp
and type
are required.
At least one of key
and key_meaning
must be set for a valid event.
Fields§
§timestamp: Option<i64>
Time in nanoseconds when the event was recorded, in the CLOCK_MONOTONIC
time base.
The timestamp is required on every key event, and users can expect that it
will always be present.
type_: Option<KeyEventType>
Type of event.
key: Option<Key>
Identifies the key ignoring modifiers, layout, prior key events, etc. This is called the “physical key” on some platforms. In cases where the key event did not originate from a physical keyboard (e.g. onscreen keyboard) this field may be empty.
modifiers: Option<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:
- type: Pressed, key: CapsLock, modifiers: None
- type: Pressed, key: A, modifiers: CapsLock
- type: Released, key: CapsLock, modifiers: CapsLock
- type: Released, key: A, modifiers: CapsLock
CapsLock is on, user presses CapsLock, then A, then releases both.
- type: Pressed, key: CapsLock, modifiers: CapsLock
- type: Pressed, key: A, modifiers: None
- type: Released, key: CapsLock, modifiers: None
- type: Released, key: A, modifiers: None
key_meaning: Option<KeyMeaning>
Meaning of the key.
repeat_sequence: Option<u32>
The sequence number of this KeyEvent
in the sequence of autorepeated
keys.
Unset if this event has been generated in the immediate response to an
input from the keyboard driver. If the KeyEvent
has been generated
through the autorepeat mechanism, this property is set and is
incremented by one for each successive generated key event.
lock_state: Option<LockState>
The lock state in effect at the time of the event.
For example, if CapsLock effect is turned on (pressing ‘a’ results in the effect ‘A’), the corresponding bit in the lock state is set.
NOTE: LockState
is different from whether the CapsLock modifier key
is actuated or not. LockState.CAPS_LOCK
can be active even if the
Caps Lock key is not currently actuated.
device_id: Option<u32>
Identifies the device originating this event.
Trait Implementations§
Source§impl<D: ResourceDialect> Decode<KeyEvent, D> for KeyEvent
impl<D: ResourceDialect> Decode<KeyEvent, D> for KeyEvent
Source§impl TypeMarker for KeyEvent
impl TypeMarker for KeyEvent
Source§fn inline_align(_context: Context) -> usize
fn inline_align(_context: Context) -> usize
Source§fn inline_size(_context: Context) -> usize
fn inline_size(_context: Context) -> usize
inline_align
.§fn encode_is_copy() -> bool
fn encode_is_copy() -> bool
Self::Owned
matches the FIDL wire
format and encoding requires no validation. When true, we can optimize
encoding arrays and vectors of Self::Owned
to a single memcpy. Read more§fn decode_is_copy() -> bool
fn decode_is_copy() -> bool
Self::Owned
matches the FIDL wire
format and decoding requires no validation. When true, we can optimize
decoding arrays and vectors of Self::Owned
to a single memcpy.Source§impl ValueTypeMarker for KeyEvent
impl ValueTypeMarker for KeyEvent
impl Persistable for KeyEvent
impl StructuralPartialEq for KeyEvent
Auto Trait Implementations§
impl Freeze for KeyEvent
impl RefUnwindSafe for KeyEvent
impl Send for KeyEvent
impl Sync for KeyEvent
impl Unpin for KeyEvent
impl UnwindSafe for KeyEvent
Blanket Implementations§
§impl<T> Body for Twhere
T: Persistable,
impl<T> Body for Twhere
T: Persistable,
§type MarkerAtTopLevel = T
type MarkerAtTopLevel = T
§type MarkerInResultUnion = T
type MarkerInResultUnion = T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)