From e6b8126600643285b4b6e0b492ac31dbc0554872 Mon Sep 17 00:00:00 2001 From: Exidex <16986685+Exidex@users.noreply.github.com> Date: Fri, 26 Jul 2024 18:38:11 +0200 Subject: [PATCH] Expose physical keys --- .gitignore | 2 + core/src/keyboard.rs | 2 + core/src/keyboard/event.rs | 7 + core/src/keyboard/physical_key.rs | 666 ++++++++++++++++++++++++++++++ winit/src/conversion.rs | 619 ++++++++++++++++++++++++++- 5 files changed, 1295 insertions(+), 1 deletion(-) create mode 100644 core/src/keyboard/physical_key.rs diff --git a/.gitignore b/.gitignore index f05ec438e4..4989f3a866 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ pkg/ Cargo.lock dist/ traces/ + +.idea/ \ No newline at end of file diff --git a/core/src/keyboard.rs b/core/src/keyboard.rs index b810ccb0d6..58c6d02ca8 100644 --- a/core/src/keyboard.rs +++ b/core/src/keyboard.rs @@ -4,8 +4,10 @@ pub mod key; mod event; mod location; mod modifiers; +mod physical_key; pub use event::Event; pub use key::Key; pub use location::Location; pub use modifiers::Modifiers; +pub use physical_key::{KeyCode, NativeKey, NativeKeyCode, PhysicalKey}; diff --git a/core/src/keyboard/event.rs b/core/src/keyboard/event.rs index 1eb4233476..6aa651055c 100644 --- a/core/src/keyboard/event.rs +++ b/core/src/keyboard/event.rs @@ -1,3 +1,4 @@ +use crate::keyboard::physical_key::PhysicalKey; use crate::keyboard::{Key, Location, Modifiers}; use crate::SmolStr; @@ -14,6 +15,9 @@ pub enum Event { /// The key pressed. key: Key, + /// The physical key pressed. + physical_key: PhysicalKey, + /// The location of the key. location: Location, @@ -29,6 +33,9 @@ pub enum Event { /// The key released. key: Key, + /// The physical key released. + physical_key: PhysicalKey, + /// The location of the key. location: Location, diff --git a/core/src/keyboard/physical_key.rs b/core/src/keyboard/physical_key.rs new file mode 100644 index 0000000000..6057b65e09 --- /dev/null +++ b/core/src/keyboard/physical_key.rs @@ -0,0 +1,666 @@ +#![allow(missing_docs)] +//! Types related to the keyboard. + +pub use crate::SmolStr; +use crate::keyboard::key::Key; + +/// Contains the platform-native physical key identifier +/// +/// The exact values vary from platform to platform (which is part of why this is a per-platform +/// enum), but the values are primarily tied to the key's physical location on the keyboard. +/// +/// This enum is primarily used to store raw keycodes when Winit doesn't map a given native +/// physical key identifier to a meaningful [`KeyCode`] variant. In the presence of identifiers we +/// haven't mapped for you yet, this lets you use use [`KeyCode`] to: +/// +/// - Correctly match key press and release events. +/// - On non-web platforms, support assigning keybinds to virtually any key through a UI. +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub enum NativeKeyCode { + Unidentified, + /// An Android "scancode". + Android(u32), + /// A macOS "scancode". + MacOS(u16), + /// A Windows "scancode". + Windows(u16), + /// An XKB "keycode". + Xkb(u32), +} + +impl std::fmt::Debug for NativeKeyCode { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + use NativeKeyCode::{Android, MacOS, Unidentified, Windows, Xkb}; + let mut debug_tuple; + match self { + Unidentified => { + debug_tuple = f.debug_tuple("Unidentified"); + } + Android(code) => { + debug_tuple = f.debug_tuple("Android"); + let _ = debug_tuple.field(&format_args!("0x{code:04X}")); + } + MacOS(code) => { + debug_tuple = f.debug_tuple("MacOS"); + let _ = debug_tuple.field(&format_args!("0x{code:04X}")); + } + Windows(code) => { + debug_tuple = f.debug_tuple("Windows"); + let _ = debug_tuple.field(&format_args!("0x{code:04X}")); + } + Xkb(code) => { + debug_tuple = f.debug_tuple("Xkb"); + let _ = debug_tuple.field(&format_args!("0x{code:04X}")); + } + } + debug_tuple.finish() + } +} + +/// Contains the platform-native logical key identifier +/// +/// Exactly what that means differs from platform to platform, but the values are to some degree +/// tied to the currently active keyboard layout. The same key on the same keyboard may also report +/// different values on different platforms, which is one of the reasons this is a per-platform +/// enum. +/// +/// This enum is primarily used to store raw keysym when Winit doesn't map a given native logical +/// key identifier to a meaningful [`Key`] variant. This lets you use [`Key`], and let the user +/// define keybinds which work in the presence of identifiers we haven't mapped for you yet. +#[derive(Clone, PartialEq, Eq, Hash, PartialOrd, Ord)] +pub enum NativeKey { + Unidentified, + /// An Android "keycode", which is similar to a "virtual-key code" on Windows. + Android(u32), + /// A macOS "scancode". There does not appear to be any direct analogue to either keysyms or + /// "virtual-key" codes in macOS, so we report the scancode instead. + MacOS(u16), + /// A Windows "virtual-key code". + Windows(u16), + /// An XKB "keysym". + Xkb(u32), + /// A "key value string". + Web(SmolStr), +} + +impl std::fmt::Debug for NativeKey { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + use NativeKey::{Android, MacOS, Unidentified, Web, Windows, Xkb}; + let mut debug_tuple; + match self { + Unidentified => { + debug_tuple = f.debug_tuple("Unidentified"); + } + Android(code) => { + debug_tuple = f.debug_tuple("Android"); + let _ = debug_tuple.field(&format_args!("0x{code:04X}")); + } + MacOS(code) => { + debug_tuple = f.debug_tuple("MacOS"); + let _ = debug_tuple.field(&format_args!("0x{code:04X}")); + } + Windows(code) => { + debug_tuple = f.debug_tuple("Windows"); + let _ = debug_tuple.field(&format_args!("0x{code:04X}")); + } + Xkb(code) => { + debug_tuple = f.debug_tuple("Xkb"); + let _ = debug_tuple.field(&format_args!("0x{code:04X}")); + } + Web(code) => { + debug_tuple = f.debug_tuple("Web"); + let _ = debug_tuple.field(code); + } + } + debug_tuple.finish() + } +} + +impl From for NativeKey { + #[inline] + fn from(code: NativeKeyCode) -> Self { + match code { + NativeKeyCode::Unidentified => NativeKey::Unidentified, + NativeKeyCode::Android(x) => NativeKey::Android(x), + NativeKeyCode::MacOS(x) => NativeKey::MacOS(x), + NativeKeyCode::Windows(x) => NativeKey::Windows(x), + NativeKeyCode::Xkb(x) => NativeKey::Xkb(x), + } + } +} + +impl PartialEq for NativeKeyCode { + #[allow(clippy::cmp_owned)] // uses less code than direct match; target is stack allocated + #[inline] + fn eq(&self, rhs: &NativeKey) -> bool { + NativeKey::from(*self) == *rhs + } +} + +impl PartialEq for NativeKey { + #[inline] + fn eq(&self, rhs: &NativeKeyCode) -> bool { + rhs == self + } +} + +/// Represents the location of a physical key. +/// +/// This type is a superset of [`KeyCode`], including an [`Unidentified`][Self::Unidentified] +/// variant. +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub enum PhysicalKey { + /// A known key code + Code(KeyCode), + /// This variant is used when the key cannot be translated to a [`KeyCode`] + /// + /// The native keycode is provided (if available) so you're able to more reliably match + /// key-press and key-release events by hashing the [`PhysicalKey`]. It is also possible to use + /// this for keybinds for non-standard keys, but such keybinds are tied to a given platform. + Unidentified(NativeKeyCode), +} + +impl From for PhysicalKey { + #[inline] + fn from(code: KeyCode) -> Self { + PhysicalKey::Code(code) + } +} + +impl From for PhysicalKey { + #[inline] + fn from(code: NativeKeyCode) -> Self { + PhysicalKey::Unidentified(code) + } +} + +impl PartialEq for PhysicalKey { + #[inline] + fn eq(&self, rhs: &KeyCode) -> bool { + match self { + PhysicalKey::Code(ref code) => code == rhs, + _ => false, + } + } +} + +impl PartialEq for KeyCode { + #[inline] + fn eq(&self, rhs: &PhysicalKey) -> bool { + rhs == self + } +} + +impl PartialEq for PhysicalKey { + #[inline] + fn eq(&self, rhs: &NativeKeyCode) -> bool { + match self { + PhysicalKey::Unidentified(ref code) => code == rhs, + _ => false, + } + } +} + +impl PartialEq for NativeKeyCode { + #[inline] + fn eq(&self, rhs: &PhysicalKey) -> bool { + rhs == self + } +} + +/// Code representing the location of a physical key +/// +/// This mostly conforms to the UI Events Specification's [`KeyboardEvent.code`] with a few +/// exceptions: +/// - The keys that the specification calls "MetaLeft" and "MetaRight" are named "SuperLeft" and +/// "SuperRight" here. +/// - The key that the specification calls "Super" is reported as `Unidentified` here. +/// +/// [`KeyboardEvent.code`]: https://w3c.github.io/uievents-code/#code-value-tables +#[non_exhaustive] +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub enum KeyCode { + /// ` on a US keyboard. This is also called a backtick or grave. + /// This is the 半角/全角/漢字 + /// (hankaku/zenkaku/kanji) key on Japanese keyboards + Backquote, + /// Used for both the US \\ (on the 101-key layout) and also for the key + /// located between the " and Enter keys on row C of the 102-, + /// 104- and 106-key layouts. + /// Labeled # on a UK (102) keyboard. + Backslash, + /// [ on a US keyboard. + BracketLeft, + /// ] on a US keyboard. + BracketRight, + /// , on a US keyboard. + Comma, + /// 0 on a US keyboard. + Digit0, + /// 1 on a US keyboard. + Digit1, + /// 2 on a US keyboard. + Digit2, + /// 3 on a US keyboard. + Digit3, + /// 4 on a US keyboard. + Digit4, + /// 5 on a US keyboard. + Digit5, + /// 6 on a US keyboard. + Digit6, + /// 7 on a US keyboard. + Digit7, + /// 8 on a US keyboard. + Digit8, + /// 9 on a US keyboard. + Digit9, + /// = on a US keyboard. + Equal, + /// Located between the left Shift and Z keys. + /// Labeled \\ on a UK keyboard. + IntlBackslash, + /// Located between the / and right Shift keys. + /// Labeled \\ (ro) on a Japanese keyboard. + IntlRo, + /// Located between the = and Backspace keys. + /// Labeled ¥ (yen) on a Japanese keyboard. \\ on a + /// Russian keyboard. + IntlYen, + /// a on a US keyboard. + /// Labeled q on an AZERTY (e.g., French) keyboard. + KeyA, + /// b on a US keyboard. + KeyB, + /// c on a US keyboard. + KeyC, + /// d on a US keyboard. + KeyD, + /// e on a US keyboard. + KeyE, + /// f on a US keyboard. + KeyF, + /// g on a US keyboard. + KeyG, + /// h on a US keyboard. + KeyH, + /// i on a US keyboard. + KeyI, + /// j on a US keyboard. + KeyJ, + /// k on a US keyboard. + KeyK, + /// l on a US keyboard. + KeyL, + /// m on a US keyboard. + KeyM, + /// n on a US keyboard. + KeyN, + /// o on a US keyboard. + KeyO, + /// p on a US keyboard. + KeyP, + /// q on a US keyboard. + /// Labeled a on an AZERTY (e.g., French) keyboard. + KeyQ, + /// r on a US keyboard. + KeyR, + /// s on a US keyboard. + KeyS, + /// t on a US keyboard. + KeyT, + /// u on a US keyboard. + KeyU, + /// v on a US keyboard. + KeyV, + /// w on a US keyboard. + /// Labeled z on an AZERTY (e.g., French) keyboard. + KeyW, + /// x on a US keyboard. + KeyX, + /// y on a US keyboard. + /// Labeled z on a QWERTZ (e.g., German) keyboard. + KeyY, + /// z on a US keyboard. + /// Labeled w on an AZERTY (e.g., French) keyboard, and y on a + /// QWERTZ (e.g., German) keyboard. + KeyZ, + /// - on a US keyboard. + Minus, + /// . on a US keyboard. + Period, + /// ' on a US keyboard. + Quote, + /// ; on a US keyboard. + Semicolon, + /// / on a US keyboard. + Slash, + /// Alt, Option, or . + AltLeft, + /// Alt, Option, or . + /// This is labeled AltGr on many keyboard layouts. + AltRight, + /// Backspace or . + /// Labeled Delete on Apple keyboards. + Backspace, + /// CapsLock or + CapsLock, + /// The application context menu key, which is typically found between the right + /// Super key and the right Control key. + ContextMenu, + /// Control or + ControlLeft, + /// Control or + ControlRight, + /// Enter or . Labeled Return on Apple keyboards. + Enter, + /// The Windows, , Command, or other OS symbol key. + SuperLeft, + /// The Windows, , Command, or other OS symbol key. + SuperRight, + /// Shift or + ShiftLeft, + /// Shift or + ShiftRight, + ///   (space) + Space, + /// Tab or + Tab, + /// Japanese: (henkan) + Convert, + /// Japanese: カタカナ/ひらがな/ローマ字 + /// (katakana/hiragana/romaji) + KanaMode, + /// Korean: HangulMode 한/영 (han/yeong) + /// + /// Japanese (Mac keyboard): (kana) + Lang1, + /// Korean: Hanja (hanja) + /// + /// Japanese (Mac keyboard): (eisu) + Lang2, + /// Japanese (word-processing keyboard): Katakana + Lang3, + /// Japanese (word-processing keyboard): Hiragana + Lang4, + /// Japanese (word-processing keyboard): Zenkaku/Hankaku + Lang5, + /// Japanese: 無変換 (muhenkan) + NonConvert, + /// . The forward delete key. + /// Note that on Apple keyboards, the key labelled Delete on the main part of + /// the keyboard is encoded as [`Backspace`]. + /// + /// [`Backspace`]: Self::Backspace + Delete, + /// Page Down, End, or + End, + /// Help. Not present on standard PC keyboards. + Help, + /// Home or + Home, + /// Insert or Ins. Not present on Apple keyboards. + Insert, + /// Page Down, PgDn, or + PageDown, + /// Page Up, PgUp, or + PageUp, + /// + ArrowDown, + /// + ArrowLeft, + /// + ArrowRight, + /// + ArrowUp, + /// On the Mac, this is used for the numpad Clear key. + NumLock, + /// 0 Ins on a keyboard. 0 on a phone or remote control + Numpad0, + /// 1 End on a keyboard. 1 or 1 QZ on a phone or remote + /// control + Numpad1, + /// 2 ↓ on a keyboard. 2 ABC on a phone or remote control + Numpad2, + /// 3 PgDn on a keyboard. 3 DEF on a phone or remote control + Numpad3, + /// 4 ← on a keyboard. 4 GHI on a phone or remote control + Numpad4, + /// 5 on a keyboard. 5 JKL on a phone or remote control + Numpad5, + /// 6 → on a keyboard. 6 MNO on a phone or remote control + Numpad6, + /// 7 Home on a keyboard. 7 PQRS or 7 PRS on a phone + /// or remote control + Numpad7, + /// 8 ↑ on a keyboard. 8 TUV on a phone or remote control + Numpad8, + /// 9 PgUp on a keyboard. 9 WXYZ or 9 WXY on a phone + /// or remote control + Numpad9, + /// + + NumpadAdd, + /// Found on the Microsoft Natural Keyboard. + NumpadBackspace, + /// C or A (All Clear). Also for use with numpads that have a + /// Clear key that is separate from the NumLock key. On the Mac, the + /// numpad Clear key is encoded as [`NumLock`]. + /// + /// [`NumLock`]: Self::NumLock + NumpadClear, + /// C (Clear Entry) + NumpadClearEntry, + /// , (thousands separator). For locales where the thousands separator + /// is a "." (e.g., Brazil), this key may generate a .. + NumpadComma, + /// . Del. For locales where the decimal separator is "," (e.g., + /// Brazil), this key may generate a ,. + NumpadDecimal, + /// / + NumpadDivide, + NumpadEnter, + /// = + NumpadEqual, + /// # on a phone or remote control device. This key is typically found + /// below the 9 key and to the right of the 0 key. + NumpadHash, + /// M Add current entry to the value stored in memory. + NumpadMemoryAdd, + /// M Clear the value stored in memory. + NumpadMemoryClear, + /// M Replace the current entry with the value stored in memory. + NumpadMemoryRecall, + /// M Replace the value stored in memory with the current entry. + NumpadMemoryStore, + /// M Subtract current entry from the value stored in memory. + NumpadMemorySubtract, + /// * on a keyboard. For use with numpads that provide mathematical + /// operations (+, - * and /). + /// + /// Use `NumpadStar` for the * key on phones and remote controls. + NumpadMultiply, + /// ( Found on the Microsoft Natural Keyboard. + NumpadParenLeft, + /// ) Found on the Microsoft Natural Keyboard. + NumpadParenRight, + /// * on a phone or remote control device. + /// + /// This key is typically found below the 7 key and to the left of + /// the 0 key. + /// + /// Use "NumpadMultiply" for the * key on + /// numeric keypads. + NumpadStar, + /// - + NumpadSubtract, + /// Esc or + Escape, + /// Fn This is typically a hardware key that does not generate a separate code. + Fn, + /// FLock or FnLock. Function Lock key. Found on the Microsoft + /// Natural Keyboard. + FnLock, + /// PrtScr SysRq or Print Screen + PrintScreen, + /// Scroll Lock + ScrollLock, + /// Pause Break + Pause, + /// Some laptops place this key to the left of the key. + /// + /// This also the "back" button (triangle) on Android. + BrowserBack, + BrowserFavorites, + /// Some laptops place this key to the right of the key. + BrowserForward, + /// The "home" button on Android. + BrowserHome, + BrowserRefresh, + BrowserSearch, + BrowserStop, + /// Eject or . This key is placed in the function section on some Apple + /// keyboards. + Eject, + /// Sometimes labelled My Computer on the keyboard + LaunchApp1, + /// Sometimes labelled Calculator on the keyboard + LaunchApp2, + LaunchMail, + MediaPlayPause, + MediaSelect, + MediaStop, + MediaTrackNext, + MediaTrackPrevious, + /// This key is placed in the function section on some Apple keyboards, replacing the + /// Eject key. + Power, + Sleep, + AudioVolumeDown, + AudioVolumeMute, + AudioVolumeUp, + WakeUp, + // Legacy modifier key. Also called "Super" in certain places. + Meta, + // Legacy modifier key. + Hyper, + Turbo, + Abort, + Resume, + Suspend, + /// Found on Sun’s USB keyboard. + Again, + /// Found on Sun’s USB keyboard. + Copy, + /// Found on Sun’s USB keyboard. + Cut, + /// Found on Sun’s USB keyboard. + Find, + /// Found on Sun’s USB keyboard. + Open, + /// Found on Sun’s USB keyboard. + Paste, + /// Found on Sun’s USB keyboard. + Props, + /// Found on Sun’s USB keyboard. + Select, + /// Found on Sun’s USB keyboard. + Undo, + /// Use for dedicated ひらがな key found on some Japanese word processing keyboards. + Hiragana, + /// Use for dedicated カタカナ key found on some Japanese word processing keyboards. + Katakana, + /// General-purpose function key. + /// Usually found at the top of the keyboard. + F1, + /// General-purpose function key. + /// Usually found at the top of the keyboard. + F2, + /// General-purpose function key. + /// Usually found at the top of the keyboard. + F3, + /// General-purpose function key. + /// Usually found at the top of the keyboard. + F4, + /// General-purpose function key. + /// Usually found at the top of the keyboard. + F5, + /// General-purpose function key. + /// Usually found at the top of the keyboard. + F6, + /// General-purpose function key. + /// Usually found at the top of the keyboard. + F7, + /// General-purpose function key. + /// Usually found at the top of the keyboard. + F8, + /// General-purpose function key. + /// Usually found at the top of the keyboard. + F9, + /// General-purpose function key. + /// Usually found at the top of the keyboard. + F10, + /// General-purpose function key. + /// Usually found at the top of the keyboard. + F11, + /// General-purpose function key. + /// Usually found at the top of the keyboard. + F12, + /// General-purpose function key. + /// Usually found at the top of the keyboard. + F13, + /// General-purpose function key. + /// Usually found at the top of the keyboard. + F14, + /// General-purpose function key. + /// Usually found at the top of the keyboard. + F15, + /// General-purpose function key. + /// Usually found at the top of the keyboard. + F16, + /// General-purpose function key. + /// Usually found at the top of the keyboard. + F17, + /// General-purpose function key. + /// Usually found at the top of the keyboard. + F18, + /// General-purpose function key. + /// Usually found at the top of the keyboard. + F19, + /// General-purpose function key. + /// Usually found at the top of the keyboard. + F20, + /// General-purpose function key. + /// Usually found at the top of the keyboard. + F21, + /// General-purpose function key. + /// Usually found at the top of the keyboard. + F22, + /// General-purpose function key. + /// Usually found at the top of the keyboard. + F23, + /// General-purpose function key. + /// Usually found at the top of the keyboard. + F24, + /// General-purpose function key. + F25, + /// General-purpose function key. + F26, + /// General-purpose function key. + F27, + /// General-purpose function key. + F28, + /// General-purpose function key. + F29, + /// General-purpose function key. + F30, + /// General-purpose function key. + F31, + /// General-purpose function key. + F32, + /// General-purpose function key. + F33, + /// General-purpose function key. + F34, + /// General-purpose function key. + F35, +} diff --git a/winit/src/conversion.rs b/winit/src/conversion.rs index fc3d1c086b..aab69bebdd 100644 --- a/winit/src/conversion.rs +++ b/winit/src/conversion.rs @@ -7,6 +7,7 @@ use crate::core::mouse; use crate::core::touch; use crate::core::window; use crate::core::{Event, Point, Size}; +use winit::keyboard::{KeyCode, NativeKeyCode, PhysicalKey}; /// Converts some [`window::Settings`] into a `WindowBuilder` from `winit`. pub fn window_settings( @@ -227,9 +228,13 @@ pub fn window_event( }.filter(|text| !text.as_str().chars().any(is_private_use)); let winit::event::KeyEvent { - state, location, .. + state, + location, + physical_key, + .. } = event; let key = key(logical_key); + let physical_key = self::physical_key(physical_key); let modifiers = self::modifiers(modifiers); let location = match location { @@ -249,6 +254,7 @@ pub fn window_event( winit::event::ElementState::Pressed => { keyboard::Event::KeyPressed { key, + physical_key, modifiers, location, text, @@ -257,6 +263,7 @@ pub fn window_event( winit::event::ElementState::Released => { keyboard::Event::KeyReleased { key, + physical_key, modifiers, location, } @@ -815,6 +822,616 @@ pub fn key(key: winit::keyboard::Key) -> keyboard::Key { } } +/// Converts physical key code from winit to an iced key code. +pub fn physical_key(key: PhysicalKey) -> keyboard::PhysicalKey { + match key { + PhysicalKey::Code(KeyCode::Backquote) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Backquote) + } + PhysicalKey::Code(KeyCode::Backslash) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Backslash) + } + PhysicalKey::Code(KeyCode::BracketLeft) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::BracketLeft) + } + PhysicalKey::Code(KeyCode::BracketRight) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::BracketRight) + } + PhysicalKey::Code(KeyCode::Comma) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Comma) + } + PhysicalKey::Code(KeyCode::Digit0) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Digit0) + } + PhysicalKey::Code(KeyCode::Digit1) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Digit1) + } + PhysicalKey::Code(KeyCode::Digit2) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Digit2) + } + PhysicalKey::Code(KeyCode::Digit3) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Digit3) + } + PhysicalKey::Code(KeyCode::Digit4) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Digit4) + } + PhysicalKey::Code(KeyCode::Digit5) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Digit5) + } + PhysicalKey::Code(KeyCode::Digit6) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Digit6) + } + PhysicalKey::Code(KeyCode::Digit7) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Digit7) + } + PhysicalKey::Code(KeyCode::Digit8) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Digit8) + } + PhysicalKey::Code(KeyCode::Digit9) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Digit9) + } + PhysicalKey::Code(KeyCode::Equal) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Equal) + } + PhysicalKey::Code(KeyCode::IntlBackslash) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::IntlBackslash) + } + PhysicalKey::Code(KeyCode::IntlRo) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::IntlRo) + } + PhysicalKey::Code(KeyCode::IntlYen) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::IntlYen) + } + PhysicalKey::Code(KeyCode::KeyA) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::KeyA) + } + PhysicalKey::Code(KeyCode::KeyB) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::KeyB) + } + PhysicalKey::Code(KeyCode::KeyC) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::KeyC) + } + PhysicalKey::Code(KeyCode::KeyD) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::KeyD) + } + PhysicalKey::Code(KeyCode::KeyE) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::KeyE) + } + PhysicalKey::Code(KeyCode::KeyF) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::KeyF) + } + PhysicalKey::Code(KeyCode::KeyG) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::KeyG) + } + PhysicalKey::Code(KeyCode::KeyH) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::KeyH) + } + PhysicalKey::Code(KeyCode::KeyI) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::KeyI) + } + PhysicalKey::Code(KeyCode::KeyJ) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::KeyJ) + } + PhysicalKey::Code(KeyCode::KeyK) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::KeyK) + } + PhysicalKey::Code(KeyCode::KeyL) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::KeyL) + } + PhysicalKey::Code(KeyCode::KeyM) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::KeyM) + } + PhysicalKey::Code(KeyCode::KeyN) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::KeyN) + } + PhysicalKey::Code(KeyCode::KeyO) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::KeyO) + } + PhysicalKey::Code(KeyCode::KeyP) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::KeyP) + } + PhysicalKey::Code(KeyCode::KeyQ) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::KeyQ) + } + PhysicalKey::Code(KeyCode::KeyR) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::KeyR) + } + PhysicalKey::Code(KeyCode::KeyS) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::KeyS) + } + PhysicalKey::Code(KeyCode::KeyT) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::KeyT) + } + PhysicalKey::Code(KeyCode::KeyU) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::KeyU) + } + PhysicalKey::Code(KeyCode::KeyV) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::KeyV) + } + PhysicalKey::Code(KeyCode::KeyW) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::KeyW) + } + PhysicalKey::Code(KeyCode::KeyX) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::KeyX) + } + PhysicalKey::Code(KeyCode::KeyY) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::KeyY) + } + PhysicalKey::Code(KeyCode::KeyZ) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::KeyZ) + } + PhysicalKey::Code(KeyCode::Minus) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Minus) + } + PhysicalKey::Code(KeyCode::Period) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Period) + } + PhysicalKey::Code(KeyCode::Quote) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Quote) + } + PhysicalKey::Code(KeyCode::Semicolon) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Semicolon) + } + PhysicalKey::Code(KeyCode::Slash) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Slash) + } + PhysicalKey::Code(KeyCode::AltLeft) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::AltLeft) + } + PhysicalKey::Code(KeyCode::AltRight) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::AltRight) + } + PhysicalKey::Code(KeyCode::Backspace) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Backspace) + } + PhysicalKey::Code(KeyCode::CapsLock) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::CapsLock) + } + PhysicalKey::Code(KeyCode::ContextMenu) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::ContextMenu) + } + PhysicalKey::Code(KeyCode::ControlLeft) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::ControlLeft) + } + PhysicalKey::Code(KeyCode::ControlRight) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::ControlRight) + } + PhysicalKey::Code(KeyCode::Enter) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Enter) + } + PhysicalKey::Code(KeyCode::SuperLeft) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::SuperLeft) + } + PhysicalKey::Code(KeyCode::SuperRight) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::SuperRight) + } + PhysicalKey::Code(KeyCode::ShiftLeft) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::ShiftLeft) + } + PhysicalKey::Code(KeyCode::ShiftRight) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::ShiftRight) + } + PhysicalKey::Code(KeyCode::Space) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Space) + } + PhysicalKey::Code(KeyCode::Tab) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Tab) + } + PhysicalKey::Code(KeyCode::Convert) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Convert) + } + PhysicalKey::Code(KeyCode::KanaMode) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::KanaMode) + } + PhysicalKey::Code(KeyCode::Lang1) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Lang1) + } + PhysicalKey::Code(KeyCode::Lang2) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Lang2) + } + PhysicalKey::Code(KeyCode::Lang3) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Lang3) + } + PhysicalKey::Code(KeyCode::Lang4) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Lang4) + } + PhysicalKey::Code(KeyCode::Lang5) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Lang5) + } + PhysicalKey::Code(KeyCode::NonConvert) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::NonConvert) + } + PhysicalKey::Code(KeyCode::Delete) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Delete) + } + PhysicalKey::Code(KeyCode::End) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::End) + } + PhysicalKey::Code(KeyCode::Help) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Help) + } + PhysicalKey::Code(KeyCode::Home) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Home) + } + PhysicalKey::Code(KeyCode::Insert) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Insert) + } + PhysicalKey::Code(KeyCode::PageDown) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::PageDown) + } + PhysicalKey::Code(KeyCode::PageUp) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::PageUp) + } + PhysicalKey::Code(KeyCode::ArrowDown) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::ArrowDown) + } + PhysicalKey::Code(KeyCode::ArrowLeft) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::ArrowLeft) + } + PhysicalKey::Code(KeyCode::ArrowRight) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::ArrowRight) + } + PhysicalKey::Code(KeyCode::ArrowUp) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::ArrowUp) + } + PhysicalKey::Code(KeyCode::NumLock) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::NumLock) + } + PhysicalKey::Code(KeyCode::Numpad0) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Numpad0) + } + PhysicalKey::Code(KeyCode::Numpad1) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Numpad1) + } + PhysicalKey::Code(KeyCode::Numpad2) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Numpad2) + } + PhysicalKey::Code(KeyCode::Numpad3) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Numpad3) + } + PhysicalKey::Code(KeyCode::Numpad4) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Numpad4) + } + PhysicalKey::Code(KeyCode::Numpad5) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Numpad5) + } + PhysicalKey::Code(KeyCode::Numpad6) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Numpad6) + } + PhysicalKey::Code(KeyCode::Numpad7) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Numpad7) + } + PhysicalKey::Code(KeyCode::Numpad8) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Numpad8) + } + PhysicalKey::Code(KeyCode::Numpad9) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Numpad9) + } + PhysicalKey::Code(KeyCode::NumpadAdd) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::NumpadAdd) + } + PhysicalKey::Code(KeyCode::NumpadBackspace) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::NumpadBackspace) + } + PhysicalKey::Code(KeyCode::NumpadClear) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::NumpadClear) + } + PhysicalKey::Code(KeyCode::NumpadClearEntry) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::NumpadClearEntry) + } + PhysicalKey::Code(KeyCode::NumpadComma) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::NumpadComma) + } + PhysicalKey::Code(KeyCode::NumpadDecimal) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::NumpadDecimal) + } + PhysicalKey::Code(KeyCode::NumpadDivide) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::NumpadDivide) + } + PhysicalKey::Code(KeyCode::NumpadEnter) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::NumpadEnter) + } + PhysicalKey::Code(KeyCode::NumpadEqual) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::NumpadEqual) + } + PhysicalKey::Code(KeyCode::NumpadHash) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::NumpadHash) + } + PhysicalKey::Code(KeyCode::NumpadMemoryAdd) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::NumpadMemoryAdd) + } + PhysicalKey::Code(KeyCode::NumpadMemoryClear) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::NumpadMemoryClear) + } + PhysicalKey::Code(KeyCode::NumpadMemoryRecall) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::NumpadMemoryRecall) + } + PhysicalKey::Code(KeyCode::NumpadMemoryStore) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::NumpadMemoryStore) + } + PhysicalKey::Code(KeyCode::NumpadMemorySubtract) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::NumpadMemorySubtract) + } + PhysicalKey::Code(KeyCode::NumpadMultiply) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::NumpadMultiply) + } + PhysicalKey::Code(KeyCode::NumpadParenLeft) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::NumpadParenLeft) + } + PhysicalKey::Code(KeyCode::NumpadParenRight) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::NumpadParenRight) + } + PhysicalKey::Code(KeyCode::NumpadStar) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::NumpadStar) + } + PhysicalKey::Code(KeyCode::NumpadSubtract) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::NumpadSubtract) + } + PhysicalKey::Code(KeyCode::Escape) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Escape) + } + PhysicalKey::Code(KeyCode::Fn) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Fn) + } + PhysicalKey::Code(KeyCode::FnLock) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::FnLock) + } + PhysicalKey::Code(KeyCode::PrintScreen) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::PrintScreen) + } + PhysicalKey::Code(KeyCode::ScrollLock) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::ScrollLock) + } + PhysicalKey::Code(KeyCode::Pause) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Pause) + } + PhysicalKey::Code(KeyCode::BrowserBack) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::BrowserBack) + } + PhysicalKey::Code(KeyCode::BrowserFavorites) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::BrowserFavorites) + } + PhysicalKey::Code(KeyCode::BrowserForward) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::BrowserForward) + } + PhysicalKey::Code(KeyCode::BrowserHome) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::BrowserHome) + } + PhysicalKey::Code(KeyCode::BrowserRefresh) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::BrowserRefresh) + } + PhysicalKey::Code(KeyCode::BrowserSearch) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::BrowserSearch) + } + PhysicalKey::Code(KeyCode::BrowserStop) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::BrowserStop) + } + PhysicalKey::Code(KeyCode::Eject) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Eject) + } + PhysicalKey::Code(KeyCode::LaunchApp1) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::LaunchApp1) + } + PhysicalKey::Code(KeyCode::LaunchApp2) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::LaunchApp2) + } + PhysicalKey::Code(KeyCode::LaunchMail) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::LaunchMail) + } + PhysicalKey::Code(KeyCode::MediaPlayPause) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::MediaPlayPause) + } + PhysicalKey::Code(KeyCode::MediaSelect) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::MediaSelect) + } + PhysicalKey::Code(KeyCode::MediaStop) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::MediaStop) + } + PhysicalKey::Code(KeyCode::MediaTrackNext) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::MediaTrackNext) + } + PhysicalKey::Code(KeyCode::MediaTrackPrevious) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::MediaTrackPrevious) + } + PhysicalKey::Code(KeyCode::Power) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Power) + } + PhysicalKey::Code(KeyCode::Sleep) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Sleep) + } + PhysicalKey::Code(KeyCode::AudioVolumeDown) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::AudioVolumeDown) + } + PhysicalKey::Code(KeyCode::AudioVolumeMute) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::AudioVolumeMute) + } + PhysicalKey::Code(KeyCode::AudioVolumeUp) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::AudioVolumeUp) + } + PhysicalKey::Code(KeyCode::WakeUp) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::WakeUp) + } + PhysicalKey::Code(KeyCode::Meta) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Meta) + } + PhysicalKey::Code(KeyCode::Hyper) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Hyper) + } + PhysicalKey::Code(KeyCode::Turbo) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Turbo) + } + PhysicalKey::Code(KeyCode::Abort) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Abort) + } + PhysicalKey::Code(KeyCode::Resume) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Resume) + } + PhysicalKey::Code(KeyCode::Suspend) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Suspend) + } + PhysicalKey::Code(KeyCode::Again) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Again) + } + PhysicalKey::Code(KeyCode::Copy) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Copy) + } + PhysicalKey::Code(KeyCode::Cut) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Cut) + } + PhysicalKey::Code(KeyCode::Find) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Find) + } + PhysicalKey::Code(KeyCode::Open) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Open) + } + PhysicalKey::Code(KeyCode::Paste) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Paste) + } + PhysicalKey::Code(KeyCode::Props) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Props) + } + PhysicalKey::Code(KeyCode::Select) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Select) + } + PhysicalKey::Code(KeyCode::Undo) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Undo) + } + PhysicalKey::Code(KeyCode::Hiragana) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Hiragana) + } + PhysicalKey::Code(KeyCode::Katakana) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::Katakana) + } + PhysicalKey::Code(KeyCode::F1) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::F1) + } + PhysicalKey::Code(KeyCode::F2) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::F2) + } + PhysicalKey::Code(KeyCode::F3) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::F3) + } + PhysicalKey::Code(KeyCode::F4) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::F4) + } + PhysicalKey::Code(KeyCode::F5) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::F5) + } + PhysicalKey::Code(KeyCode::F6) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::F6) + } + PhysicalKey::Code(KeyCode::F7) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::F7) + } + PhysicalKey::Code(KeyCode::F8) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::F8) + } + PhysicalKey::Code(KeyCode::F9) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::F9) + } + PhysicalKey::Code(KeyCode::F10) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::F10) + } + PhysicalKey::Code(KeyCode::F11) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::F11) + } + PhysicalKey::Code(KeyCode::F12) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::F12) + } + PhysicalKey::Code(KeyCode::F13) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::F13) + } + PhysicalKey::Code(KeyCode::F14) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::F14) + } + PhysicalKey::Code(KeyCode::F15) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::F15) + } + PhysicalKey::Code(KeyCode::F16) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::F16) + } + PhysicalKey::Code(KeyCode::F17) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::F17) + } + PhysicalKey::Code(KeyCode::F18) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::F18) + } + PhysicalKey::Code(KeyCode::F19) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::F19) + } + PhysicalKey::Code(KeyCode::F20) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::F20) + } + PhysicalKey::Code(KeyCode::F21) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::F21) + } + PhysicalKey::Code(KeyCode::F22) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::F22) + } + PhysicalKey::Code(KeyCode::F23) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::F23) + } + PhysicalKey::Code(KeyCode::F24) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::F24) + } + PhysicalKey::Code(KeyCode::F25) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::F25) + } + PhysicalKey::Code(KeyCode::F26) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::F26) + } + PhysicalKey::Code(KeyCode::F27) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::F27) + } + PhysicalKey::Code(KeyCode::F28) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::F28) + } + PhysicalKey::Code(KeyCode::F29) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::F29) + } + PhysicalKey::Code(KeyCode::F30) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::F30) + } + PhysicalKey::Code(KeyCode::F31) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::F31) + } + PhysicalKey::Code(KeyCode::F32) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::F32) + } + PhysicalKey::Code(KeyCode::F33) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::F33) + } + PhysicalKey::Code(KeyCode::F34) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::F34) + } + PhysicalKey::Code(KeyCode::F35) => { + keyboard::PhysicalKey::Code(keyboard::KeyCode::F35) + } + PhysicalKey::Code(_) => unreachable!(), // needed because of #[non_exhaustive] in winit + PhysicalKey::Unidentified(native_key_code) => { + let native_key_code = match native_key_code { + NativeKeyCode::Unidentified => { + keyboard::NativeKeyCode::Unidentified + } + NativeKeyCode::Android(scancode) => { + keyboard::NativeKeyCode::Android(scancode) + } + NativeKeyCode::MacOS(scancode) => { + keyboard::NativeKeyCode::MacOS(scancode) + } + NativeKeyCode::Windows(scancode) => { + keyboard::NativeKeyCode::Windows(scancode) + } + NativeKeyCode::Xkb(keycode) => { + keyboard::NativeKeyCode::Xkb(keycode) + } + }; + + keyboard::PhysicalKey::Unidentified(native_key_code) + } + } +} + /// Converts some [`UserAttention`] into it's `winit` counterpart. /// /// [`UserAttention`]: window::UserAttention