diff --git a/druid-shell/Cargo.toml b/druid-shell/Cargo.toml index c662ca4085..54bd44e9e0 100755 --- a/druid-shell/Cargo.toml +++ b/druid-shell/Cargo.toml @@ -50,7 +50,7 @@ time = "0.3.0" cfg-if = "1.0.0" instant = { version = "0.1.6", features = ["wasm-bindgen"] } anyhow = "1.0.32" -keyboard-types = { version = "0.5.0", default_features = false } +keyboard-types = { version = "0.6.2", default_features = false } # Optional dependencies image = { version = "0.23.12", optional = true, default_features = false } diff --git a/druid-shell/src/backend/gtk/keycodes.rs b/druid-shell/src/backend/gtk/keycodes.rs index 69c8beb2de..ef14066c7e 100644 --- a/druid-shell/src/backend/gtk/keycodes.rs +++ b/druid-shell/src/backend/gtk/keycodes.rs @@ -90,19 +90,19 @@ pub fn raw_key_to_key(raw: RawKey) -> Option { F10 => Key::F10, F11 => Key::F11, F12 => Key::F12, + Tools | F13 => Key::F13, + F14 | Launch5 => Key::F14, + F15 | Launch6 => Key::F15, + F16 | Launch7 => Key::F16, + F17 | Launch8 => Key::F17, + F18 | Launch9 => Key::F18, + F19 => Key::F19, + F20 => Key::F20, + F21 => Key::F21, + F22 => Key::F22, + F23 => Key::F23, + F24 => Key::F24, // not available in keyboard-types - // Tools | F13 => Key::F13, - // F14 | Launch5 => Key::F14, - // F15 | Launch6 => Key::F15, - // F16 | Launch7 => Key::F16, - // F17 | Launch8 => Key::F17, - // F18 | Launch9 => Key::F18, - // F19 => Key::F19, - // F20 => Key::F20, - // F21 => Key::F21, - // F22 => Key::F22, - // F23 => Key::F23, - // F24 => Key::F24, // Calculator => Key::LaunchCalculator, // MyComputer | Explorer => Key::LaunchMyComputer, // ISO_Level3_Latch => Key::AltGraphLatch, @@ -257,6 +257,18 @@ pub fn key_to_raw_key(src: &Key) -> Option { Key::F10 => F10, Key::F11 => F11, Key::F12 => F12, + Key::F13 => F13, + Key::F14 => F14, + Key::F15 => F15, + Key::F16 => F16, + Key::F17 => F17, + Key::F18 => F18, + Key::F19 => F19, + Key::F20 => F20, + Key::F21 => F21, + Key::F22 => F22, + Key::F23 => F23, + Key::F24 => F24, Key::PrintScreen => Print, Key::ScrollLock => Scroll_Lock, diff --git a/druid-shell/src/backend/mac/keyboard.rs b/druid-shell/src/backend/mac/keyboard.rs index a892ee6a98..dd5b68fd33 100644 --- a/druid-shell/src/backend/mac/keyboard.rs +++ b/druid-shell/src/backend/mac/keyboard.rs @@ -103,15 +103,13 @@ fn key_code_to_code(key_code: u16) -> Code { 0x37 => Code::MetaLeft, 0x38 => Code::ShiftLeft, 0x39 => Code::CapsLock, - // Note: in the linked source doc, this is "OSLeft" 0x3a => Code::AltLeft, 0x3b => Code::ControlLeft, 0x3c => Code::ShiftRight, - // Note: in the linked source doc, this is "OSRight" 0x3d => Code::AltRight, 0x3e => Code::ControlRight, - 0x3f => Code::Fn, // No events fired - //0x40 => Code::F17, + 0x3f => Code::Fn, + 0x40 => Code::F17, 0x41 => Code::NumpadDecimal, 0x43 => Code::NumpadMultiply, 0x45 => Code::NumpadAdd, @@ -122,8 +120,8 @@ fn key_code_to_code(key_code: u16) -> Code { 0x4b => Code::NumpadDivide, 0x4c => Code::NumpadEnter, 0x4e => Code::NumpadSubtract, - //0x4f => Code::F18, - //0x50 => Code::F19, + 0x4f => Code::F18, + 0x50 => Code::F19, 0x51 => Code::NumpadEqual, 0x52 => Code::Numpad0, 0x53 => Code::Numpad1, @@ -133,7 +131,7 @@ fn key_code_to_code(key_code: u16) -> Code { 0x57 => Code::Numpad5, 0x58 => Code::Numpad6, 0x59 => Code::Numpad7, - //0x5a => Code::F20, + 0x5a => Code::F20, 0x5b => Code::Numpad8, 0x5c => Code::Numpad9, 0x5d => Code::IntlYen, @@ -148,16 +146,16 @@ fn key_code_to_code(key_code: u16) -> Code { 0x66 => Code::Lang2, 0x67 => Code::F11, 0x68 => Code::Lang1, - // Note: this is listed as F13, but in testing with a standard - // USB kb, this the code produced by PrtSc. - 0x69 => Code::PrintScreen, - //0x6a => Code::F16, - //0x6b => Code::F14, + 0x69 => Code::F13, + 0x6a => Code::F16, + 0x6b => Code::F14, 0x6d => Code::F10, 0x6e => Code::ContextMenu, 0x6f => Code::F12, - //0x71 => Code::F15, - 0x72 => Code::Help, + 0x71 => Code::F15, + // Apple hasn't been producing any keyboards with `Help` anymore since + // 2007. So this can be considered Insert instead. + 0x72 => Code::Insert, 0x73 => Code::Home, 0x74 => Code::PageUp, 0x75 => Code::Delete, @@ -206,6 +204,18 @@ fn code_to_key(code: Code) -> Option { Code::F10 => KbKey::F10, Code::F11 => KbKey::F11, Code::F12 => KbKey::F12, + Code::F13 => KbKey::F13, + Code::F14 => KbKey::F14, + Code::F15 => KbKey::F15, + Code::F16 => KbKey::F16, + Code::F17 => KbKey::F17, + Code::F18 => KbKey::F18, + Code::F19 => KbKey::F19, + Code::F20 => KbKey::F20, + Code::F21 => KbKey::F21, + Code::F22 => KbKey::F22, + Code::F23 => KbKey::F23, + Code::F24 => KbKey::F24, Code::Pause => KbKey::Pause, Code::ScrollLock => KbKey::ScrollLock, Code::PrintScreen => KbKey::PrintScreen, diff --git a/druid-shell/src/backend/mac/menu.rs b/druid-shell/src/backend/mac/menu.rs index 24b7ceed67..a764128251 100644 --- a/druid-shell/src/backend/mac/menu.rs +++ b/druid-shell/src/backend/mac/menu.rs @@ -143,14 +143,14 @@ impl HotKey { KbKey::F10 => "\u{F70D}", KbKey::F11 => "\u{F70E}", KbKey::F12 => "\u{F70F}", - //KbKey::F13 => "\u{F710}", - //KbKey::F14 => "\u{F711}", - //KbKey::F15 => "\u{F712}", - //KbKey::F16 => "\u{F713}", - //KbKey::F17 => "\u{F714}", - //KbKey::F18 => "\u{F715}", - //KbKey::F19 => "\u{F716}", - //KbKey::F20 => "\u{F717}", + KbKey::F13 => "\u{F710}", + KbKey::F14 => "\u{F711}", + KbKey::F15 => "\u{F712}", + KbKey::F16 => "\u{F713}", + KbKey::F17 => "\u{F714}", + KbKey::F18 => "\u{F715}", + KbKey::F19 => "\u{F716}", + KbKey::F20 => "\u{F717}", _ => { eprintln!("no key equivalent for {:?}", self); "" diff --git a/druid-shell/src/backend/shared/keyboard.rs b/druid-shell/src/backend/shared/keyboard.rs index dfc9144a59..2d9ac9a999 100644 --- a/druid-shell/src/backend/shared/keyboard.rs +++ b/druid-shell/src/backend/shared/keyboard.rs @@ -146,10 +146,13 @@ pub fn hardware_keycode_to_code(hw_keycode: u16) -> Code { 0x0059 => Code::Numpad3, 0x005A => Code::Numpad0, 0x005B => Code::NumpadDecimal, + 0x005D => Code::Lang5, 0x005E => Code::IntlBackslash, 0x005F => Code::F11, 0x0060 => Code::F12, 0x0061 => Code::IntlRo, + 0x0062 => Code::Lang3, + 0x0063 => Code::Lang4, 0x0064 => Code::Convert, 0x0065 => Code::KanaMode, 0x0066 => Code::NonConvert, @@ -171,8 +174,10 @@ pub fn hardware_keycode_to_code(hw_keycode: u16) -> Code { 0x0079 => Code::AudioVolumeMute, 0x007A => Code::AudioVolumeDown, 0x007B => Code::AudioVolumeUp, + 0x007C => Code::Power, 0x007D => Code::NumpadEqual, 0x007F => Code::Pause, + 0x0080 => Code::ShowAllWindows, 0x0081 => Code::NumpadComma, 0x0082 => Code::Lang1, 0x0083 => Code::Lang2, @@ -192,6 +197,7 @@ pub fn hardware_keycode_to_code(hw_keycode: u16) -> Code { 0x0091 => Code::Cut, 0x0092 => Code::Help, 0x0094 => Code::LaunchApp2, + 0x0096 => Code::Sleep, 0x0097 => Code::WakeUp, 0x0098 => Code::LaunchApp1, // key to right of volume controls on T430s produces 0x9C @@ -205,10 +211,43 @@ pub fn hardware_keycode_to_code(hw_keycode: u16) -> Code { 0x00AC => Code::MediaPlayPause, 0x00AD => Code::MediaTrackPrevious, 0x00AE => Code::MediaStop, + 0x00AF => Code::MediaRecord, + 0x00B0 => Code::MediaRewind, 0x00B3 => Code::MediaSelect, 0x00B4 => Code::BrowserHome, 0x00B5 => Code::BrowserRefresh, + 0x00BB => Code::NumpadParenLeft, + 0x00BC => Code::NumpadParenRight, + 0x00BF => Code::F13, + 0x00C0 => Code::F14, + 0x00C1 => Code::F15, + 0x00C2 => Code::F16, + 0x00C3 => Code::F17, + 0x00C4 => Code::F18, + 0x00C5 => Code::F19, + 0x00C6 => Code::F20, + 0x00C7 => Code::F21, + 0x00C8 => Code::F22, + 0x00C9 => Code::F23, + 0x00CA => Code::F24, + 0x00D1 => Code::MediaPause, + 0x00D7 => Code::MediaPlay, + 0x00D8 => Code::MediaFastForward, 0x00E1 => Code::BrowserSearch, + 0x00E8 => Code::BrightnessDown, + 0x00E9 => Code::BrightnessUp, + 0x00EB => Code::DisplayToggleIntExt, + 0x00EF => Code::MailSend, + 0x00F0 => Code::MailReply, + 0x00F1 => Code::MailForward, + 0x0100 => Code::MicrophoneMuteToggle, + 0x017C => Code::ZoomToggle, + 0x024B => Code::LaunchControlPanel, + 0x024C => Code::SelectTask, + 0x024D => Code::LaunchScreenSaver, + 0x024F => Code::LaunchAssistant, + 0x0250 => Code::KeyboardLayoutSelect, + 0x0281 => Code::PrivacyScreenToggle, _ => Code::Unidentified, } } diff --git a/druid-shell/src/backend/web/keycodes.rs b/druid-shell/src/backend/web/keycodes.rs index fa2d4f73cc..09bbff8f48 100644 --- a/druid-shell/src/backend/web/keycodes.rs +++ b/druid-shell/src/backend/web/keycodes.rs @@ -36,181 +36,7 @@ pub(crate) fn convert_keyboard_event( } fn convert_code(code: &str) -> Code { - match code { - "Backquote" => Code::Backquote, - "Backslash" => Code::Backslash, - "BracketLeft" => Code::BracketLeft, - "BracketRight" => Code::BracketRight, - "Comma" => Code::Comma, - "Digit0" => Code::Digit0, - "Digit1" => Code::Digit1, - "Digit2" => Code::Digit2, - "Digit3" => Code::Digit3, - "Digit4" => Code::Digit4, - "Digit5" => Code::Digit5, - "Digit6" => Code::Digit6, - "Digit7" => Code::Digit7, - "Digit8" => Code::Digit8, - "Digit9" => Code::Digit9, - "Equal" => Code::Equal, - "IntlBackslash" => Code::IntlBackslash, - "IntlRo" => Code::IntlRo, - "IntlYen" => Code::IntlYen, - "KeyA" => Code::KeyA, - "KeyB" => Code::KeyB, - "KeyC" => Code::KeyC, - "KeyD" => Code::KeyD, - "KeyE" => Code::KeyE, - "KeyF" => Code::KeyF, - "KeyG" => Code::KeyG, - "KeyH" => Code::KeyH, - "KeyI" => Code::KeyI, - "KeyJ" => Code::KeyJ, - "KeyK" => Code::KeyK, - "KeyL" => Code::KeyL, - "KeyM" => Code::KeyM, - "KeyN" => Code::KeyN, - "KeyO" => Code::KeyO, - "KeyP" => Code::KeyP, - "KeyQ" => Code::KeyQ, - "KeyR" => Code::KeyR, - "KeyS" => Code::KeyS, - "KeyT" => Code::KeyT, - "KeyU" => Code::KeyU, - "KeyV" => Code::KeyV, - "KeyW" => Code::KeyW, - "KeyX" => Code::KeyX, - "KeyY" => Code::KeyY, - "KeyZ" => Code::KeyZ, - "Minus" => Code::Minus, - "Period" => Code::Period, - "Quote" => Code::Quote, - "Semicolon" => Code::Semicolon, - "Slash" => Code::Slash, - "AltLeft" => Code::AltLeft, - "AltRight" => Code::AltRight, - "Backspace" => Code::Backspace, - "CapsLock" => Code::CapsLock, - "ContextMenu" => Code::ContextMenu, - "ControlLeft" => Code::ControlLeft, - "ControlRight" => Code::ControlRight, - "Enter" => Code::Enter, - "MetaLeft" => Code::MetaLeft, - "MetaRight" => Code::MetaRight, - "ShiftLeft" => Code::ShiftLeft, - "ShiftRight" => Code::ShiftRight, - "Space" => Code::Space, - "Tab" => Code::Tab, - "Convert" => Code::Convert, - "KanaMode" => Code::KanaMode, - "Lang1" => Code::Lang1, - "Lang2" => Code::Lang2, - "Lang3" => Code::Lang3, - "Lang4" => Code::Lang4, - "Lang5" => Code::Lang5, - "NonConvert" => Code::NonConvert, - "Delete" => Code::Delete, - "End" => Code::End, - "Help" => Code::Help, - "Home" => Code::Home, - "Insert" => Code::Insert, - "PageDown" => Code::PageDown, - "PageUp" => Code::PageUp, - "ArrowDown" => Code::ArrowDown, - "ArrowLeft" => Code::ArrowLeft, - "ArrowRight" => Code::ArrowRight, - "ArrowUp" => Code::ArrowUp, - "NumLock" => Code::NumLock, - "Numpad0" => Code::Numpad0, - "Numpad1" => Code::Numpad1, - "Numpad2" => Code::Numpad2, - "Numpad3" => Code::Numpad3, - "Numpad4" => Code::Numpad4, - "Numpad5" => Code::Numpad5, - "Numpad6" => Code::Numpad6, - "Numpad7" => Code::Numpad7, - "Numpad8" => Code::Numpad8, - "Numpad9" => Code::Numpad9, - "NumpadAdd" => Code::NumpadAdd, - "NumpadBackspace" => Code::NumpadBackspace, - "NumpadClear" => Code::NumpadClear, - "NumpadClearEntry" => Code::NumpadClearEntry, - "NumpadComma" => Code::NumpadComma, - "NumpadDecimal" => Code::NumpadDecimal, - "NumpadDivide" => Code::NumpadDivide, - "NumpadEnter" => Code::NumpadEnter, - "NumpadEqual" => Code::NumpadEqual, - "NumpadHash" => Code::NumpadHash, - "NumpadMemoryAdd" => Code::NumpadMemoryAdd, - "NumpadMemoryClear" => Code::NumpadMemoryClear, - "NumpadMemoryRecall" => Code::NumpadMemoryRecall, - "NumpadMemoryStore" => Code::NumpadMemoryStore, - "NumpadMemorySubtract" => Code::NumpadMemorySubtract, - "NumpadMultiply" => Code::NumpadMultiply, - "NumpadParenLeft" => Code::NumpadParenLeft, - "NumpadParenRight" => Code::NumpadParenRight, - "NumpadStar" => Code::NumpadStar, - "NumpadSubtract" => Code::NumpadSubtract, - "Escape" => Code::Escape, - "F1" => Code::F1, - "F2" => Code::F2, - "F3" => Code::F3, - "F4" => Code::F4, - "F5" => Code::F5, - "F6" => Code::F6, - "F7" => Code::F7, - "F8" => Code::F8, - "F9" => Code::F9, - "F10" => Code::F10, - "F11" => Code::F11, - "F12" => Code::F12, - "Fn" => Code::Fn, - "FnLock" => Code::FnLock, - "PrintScreen" => Code::PrintScreen, - "ScrollLock" => Code::ScrollLock, - "Pause" => Code::Pause, - "BrowserBack" => Code::BrowserBack, - "BrowserFavorites" => Code::BrowserFavorites, - "BrowserForward" => Code::BrowserForward, - "BrowserHome" => Code::BrowserHome, - "BrowserRefresh" => Code::BrowserRefresh, - "BrowserSearch" => Code::BrowserSearch, - "BrowserStop" => Code::BrowserStop, - "Eject" => Code::Eject, - "LaunchApp1" => Code::LaunchApp1, - "LaunchApp2" => Code::LaunchApp2, - "LaunchMail" => Code::LaunchMail, - "MediaPlayPause" => Code::MediaPlayPause, - "MediaSelect" => Code::MediaSelect, - "MediaStop" => Code::MediaStop, - "MediaTrackNext" => Code::MediaTrackNext, - "MediaTrackPrevious" => Code::MediaTrackPrevious, - "Power" => Code::Power, - "Sleep" => Code::Sleep, - "AudioVolumeDown" => Code::AudioVolumeDown, - "AudioVolumeMute" => Code::AudioVolumeMute, - "AudioVolumeUp" => Code::AudioVolumeUp, - "WakeUp" => Code::WakeUp, - "Hyper" => Code::Hyper, - "Super" => Code::Super, - "Turbo" => Code::Turbo, - "Abort" => Code::Abort, - "Resume" => Code::Resume, - "Suspend" => Code::Suspend, - "Again" => Code::Again, - "Copy" => Code::Copy, - "Cut" => Code::Cut, - "Find" => Code::Find, - "Open" => Code::Open, - "Paste" => Code::Paste, - "Props" => Code::Props, - "Select" => Code::Select, - "Undo" => Code::Undo, - "Hiragana" => Code::Hiragana, - "Katakana" => Code::Katakana, - // Should be exhaustive but in case not, use reasonable default - _ => Code::Unidentified, - } + code.parse().unwrap_or(Code::Unidentified) } fn convert_location(loc: u32) -> Location { diff --git a/druid-shell/src/backend/windows/keyboard.rs b/druid-shell/src/backend/windows/keyboard.rs index 2d5906c93e..c81d320bc3 100644 --- a/druid-shell/src/backend/windows/keyboard.rs +++ b/druid-shell/src/backend/windows/keyboard.rs @@ -31,7 +31,8 @@ use winapi::um::winuser::{ VK_BACK, VK_BROWSER_BACK, VK_BROWSER_FAVORITES, VK_BROWSER_FORWARD, VK_BROWSER_HOME, VK_BROWSER_REFRESH, VK_BROWSER_SEARCH, VK_BROWSER_STOP, VK_CANCEL, VK_CAPITAL, VK_CLEAR, VK_CONTROL, VK_CONVERT, VK_CRSEL, VK_DECIMAL, VK_DELETE, VK_DIVIDE, VK_DOWN, VK_END, VK_EREOF, - VK_ESCAPE, VK_EXECUTE, VK_EXSEL, VK_F1, VK_F10, VK_F11, VK_F12, VK_F2, VK_F3, VK_F4, VK_F5, + VK_ESCAPE, VK_EXECUTE, VK_EXSEL, VK_F1, VK_F10, VK_F11, VK_F12, VK_F13, VK_F14, VK_F15, VK_F16, + VK_F17, VK_F18, VK_F19, VK_F2, VK_F20, VK_F21, VK_F22, VK_F23, VK_F24, VK_F3, VK_F4, VK_F5, VK_F6, VK_F7, VK_F8, VK_F9, VK_FINAL, VK_HELP, VK_HOME, VK_INSERT, VK_JUNJA, VK_KANA, VK_KANJI, VK_LAUNCH_APP1, VK_LAUNCH_APP2, VK_LAUNCH_MAIL, VK_LAUNCH_MEDIA_SELECT, VK_LCONTROL, VK_LEFT, VK_LMENU, VK_LSHIFT, VK_LWIN, VK_MEDIA_NEXT_TRACK, VK_MEDIA_PLAY_PAUSE, VK_MEDIA_PREV_TRACK, @@ -207,29 +208,51 @@ fn scan_to_code(scan_code: u32) -> Code { 0x57 => F11, 0x58 => F12, 0x59 => NumpadEqual, + 0x64 => F13, + 0x65 => F14, + 0x66 => F15, + 0x67 => F16, + 0x68 => F17, + 0x69 => F18, + 0x6A => F19, + 0x6B => F20, + 0x6C => F21, + 0x6D => F22, + 0x6E => F23, 0x70 => KanaMode, 0x71 => Lang2, 0x72 => Lang1, 0x73 => IntlRo, + 0x76 => F24, + 0x77 => Lang4, + 0x78 => Lang3, 0x79 => Convert, 0x7B => NonConvert, 0x7D => IntlYen, 0x7E => NumpadComma, + 0x108 => Undo, + 0x10A => Paste, 0x110 => MediaTrackPrevious, + 0x117 => Cut, + 0x118 => Copy, 0x119 => MediaTrackNext, 0x11C => NumpadEnter, 0x11D => ControlRight, + 0x11E => LaunchMail, 0x120 => AudioVolumeMute, 0x121 => LaunchApp2, 0x122 => MediaPlayPause, 0x124 => MediaStop, + 0x12C => Eject, 0x12E => AudioVolumeDown, 0x130 => AudioVolumeUp, 0x132 => BrowserHome, 0x135 => NumpadDivide, 0x137 => PrintScreen, 0x138 => AltRight, + 0x13B => Help, 0x145 => NumLock, + 0x146 => Pause, 0x147 => Home, 0x148 => ArrowUp, 0x149 => PageUp, @@ -244,6 +267,8 @@ fn scan_to_code(scan_code: u32) -> Code { 0x15C => MetaRight, 0x15D => ContextMenu, 0x15E => Power, + 0x15F => Sleep, + 0x163 => WakeUp, 0x165 => BrowserSearch, 0x166 => BrowserFavorites, 0x167 => BrowserRefresh, @@ -415,6 +440,18 @@ pub(crate) fn key_to_vk(key: &KbKey) -> Option { KbKey::F10 => VK_F10, KbKey::F11 => VK_F11, KbKey::F12 => VK_F12, + KbKey::F13 => VK_F13, + KbKey::F14 => VK_F14, + KbKey::F15 => VK_F15, + KbKey::F16 => VK_F16, + KbKey::F17 => VK_F17, + KbKey::F18 => VK_F18, + KbKey::F19 => VK_F19, + KbKey::F20 => VK_F20, + KbKey::F21 => VK_F21, + KbKey::F22 => VK_F22, + KbKey::F23 => VK_F23, + KbKey::F24 => VK_F24, KbKey::NumLock => VK_NUMLOCK, KbKey::ScrollLock => VK_SCROLL, KbKey::BrowserBack => VK_BROWSER_BACK, diff --git a/druid-shell/src/backend/windows/keycodes.rs b/druid-shell/src/backend/windows/keycodes.rs index d4420c24e8..fa4c3056f6 100644 --- a/druid-shell/src/backend/windows/keycodes.rs +++ b/druid-shell/src/backend/windows/keycodes.rs @@ -197,18 +197,18 @@ map_keys! { VK_F10 => KeyCode::F10, VK_F11 => KeyCode::F11, VK_F12 => KeyCode::F12 - //VK_F13 => KeyCode::F13, - //VK_F14 => KeyCode::F14, - //VK_F15 => KeyCode::F15, - //VK_F16 => KeyCode::F16, - //VK_F17 => KeyCode::F17, - //VK_F18 => KeyCode::F18, - //VK_F19 => KeyCode::F19, - //VK_F20 => KeyCode::F20, - //VK_F21 => KeyCode::F21, - //VK_F22 => KeyCode::F22, - //VK_F23 => KeyCode::F23, - //VK_F24 => KeyCode::F24, + VK_F13 => KeyCode::F13, + VK_F14 => KeyCode::F14, + VK_F15 => KeyCode::F15, + VK_F16 => KeyCode::F16, + VK_F17 => KeyCode::F17, + VK_F18 => KeyCode::F18, + VK_F19 => KeyCode::F19, + VK_F20 => KeyCode::F20, + VK_F21 => KeyCode::F21, + VK_F22 => KeyCode::F22, + VK_F23 => KeyCode::F23, + VK_F24 => KeyCode::F24, } #[cfg(test)] diff --git a/druid-shell/src/backend/x11/keycodes.rs b/druid-shell/src/backend/x11/keycodes.rs index 6bbb03068e..3b5a0bb9ac 100644 --- a/druid-shell/src/backend/x11/keycodes.rs +++ b/druid-shell/src/backend/x11/keycodes.rs @@ -69,19 +69,19 @@ pub fn map_key(keysym: u32) -> Key { XKB_KEY_F10 => F10, XKB_KEY_F11 => F11, XKB_KEY_F12 => F12, + XKB_KEY_XF86Tools | XKB_KEY_F13 => F13, + XKB_KEY_F14 | XKB_KEY_XF86Launch5 => F14, + XKB_KEY_F15 | XKB_KEY_XF86Launch6 => F15, + XKB_KEY_F16 | XKB_KEY_XF86Launch7 => F16, + XKB_KEY_F17 | XKB_KEY_XF86Launch8 => F17, + XKB_KEY_F18 | XKB_KEY_XF86Launch9 => F18, + XKB_KEY_F19 => F19, + XKB_KEY_F20 => F20, + XKB_KEY_F21 => F21, + XKB_KEY_F22 => F22, + XKB_KEY_F23 => F23, + XKB_KEY_F24 => F24, // not available in keyboard-types - // XKB_KEY_XF86Tools | XKB_KEY_F13 => F13, - // XKB_KEY_F14 | XKB_KEY_XF86Launch5 => F14, - // XKB_KEY_F15 | XKB_KEY_XF86Launch6 => F15, - // XKB_KEY_F16 | XKB_KEY_XF86Launch7 => F16, - // XKB_KEY_F17 | XKB_KEY_XF86Launch8 => F17, - // XKB_KEY_F18 | XKB_KEY_XF86Launch9 => F18, - // XKB_KEY_F19 => F19, - // XKB_KEY_F20 => F20, - // XKB_KEY_F21 => F21, - // XKB_KEY_F22 => F22, - // XKB_KEY_F23 => F23, - // XKB_KEY_F24 => F24, // XKB_KEY_XF86Calculator => LaunchCalculator, // XKB_KEY_XF86MyComputer | XKB_KEY_XF86Explorer => LaunchMyComputer, // XKB_KEY_ISO_Level3_Latch => AltGraphLatch,