#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)] pub struct KeyboardModifiers { pub shift: bool, pub control: bool, pub alt: bool, pub super_key: bool, } #[derive(Clone, Debug, Eq, PartialEq)] pub enum KeyboardKey { Character(String), Enter, Tab, Escape, Backspace, Delete, ArrowLeft, ArrowRight, ArrowUp, ArrowDown, Home, End, Unknown, } #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum KeyboardEventKind { Pressed, Released, } #[derive(Clone, Debug, Eq, PartialEq)] pub struct KeyboardEvent { pub keycode: u32, pub kind: KeyboardEventKind, pub key: KeyboardKey, pub modifiers: KeyboardModifiers, pub text: Option, } impl KeyboardEvent { pub fn new( keycode: u32, kind: KeyboardEventKind, key: KeyboardKey, modifiers: KeyboardModifiers, text: Option, ) -> Self { Self { keycode, kind, key, modifiers, text, } } }