Skip to content

Commit

Permalink
fix(linux): add missing function keys for linux (#1040)
Browse files Browse the repository at this point in the history
* Add missing function keys F13-F24 to linux implementation

* Added change file
  • Loading branch information
Teddytrombone authored Jan 22, 2025
1 parent 6fda498 commit 94afde9
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changes/fix-linux-missing-function-keys.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tao": patch
---

Add missing function keys F13-F24 to linux implementation
12 changes: 12 additions & 0 deletions src/platform_impl/linux/keyboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,18 @@ pub(crate) fn raw_key_to_key(gdk_key: RawKey) -> Option<Key<'static>> {
F10 => Some(Key::F10),
F11 => Some(Key::F11),
F12 => Some(Key::F12),
F13 => Some(Key::F13),
F14 => Some(Key::F14),
F15 => Some(Key::F15),
F16 => Some(Key::F16),
F17 => Some(Key::F17),
F18 => Some(Key::F18),
F19 => Some(Key::F19),
F20 => Some(Key::F20),
F21 => Some(Key::F21),
F22 => Some(Key::F22),
F23 => Some(Key::F23),
F24 => Some(Key::F24),

Print => Some(Key::PrintScreen),
Scroll_Lock => Some(Key::ScrollLock),
Expand Down
24 changes: 24 additions & 0 deletions src/platform_impl/linux/keycode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,18 @@ pub fn keycode_to_scancode(code: KeyCode) -> Option<u32> {
KeyCode::F10 => Some(0x004C),
KeyCode::F11 => Some(0x005F),
KeyCode::F12 => Some(0x0060),
KeyCode::F13 => Some(0x00BF),
KeyCode::F14 => Some(0x00C0),
KeyCode::F15 => Some(0x00C1),
KeyCode::F16 => Some(0x00C2),
KeyCode::F17 => Some(0x00C3),
KeyCode::F18 => Some(0x00C4),
KeyCode::F19 => Some(0x00C5),
KeyCode::F20 => Some(0x00C6),
KeyCode::F21 => Some(0x00C7),
KeyCode::F22 => Some(0x00C8),
KeyCode::F23 => Some(0x00C9),
KeyCode::F24 => Some(0x00CA),
KeyCode::PrintScreen => Some(0x006B),
KeyCode::ScrollLock => Some(0x004E),
KeyCode::Pause => Some(0x007F),
Expand Down Expand Up @@ -295,6 +307,18 @@ pub fn keycode_from_scancode(scancode: u32) -> KeyCode {
0x00B3 => KeyCode::MediaSelect,
0x00B4 => KeyCode::BrowserHome,
0x00B5 => KeyCode::BrowserRefresh,
0x00BF => KeyCode::F13,
0x00C0 => KeyCode::F14,
0x00C1 => KeyCode::F15,
0x00C2 => KeyCode::F16,
0x00C3 => KeyCode::F17,
0x00C4 => KeyCode::F18,
0x00C5 => KeyCode::F19,
0x00C6 => KeyCode::F20,
0x00C7 => KeyCode::F21,
0x00C8 => KeyCode::F22,
0x00C9 => KeyCode::F23,
0x00CA => KeyCode::F24,
0x00E1 => KeyCode::BrowserSearch,
_ => KeyCode::Unidentified(NativeKeyCode::Gtk(scancode as u16)),
}
Expand Down

0 comments on commit 94afde9

Please sign in to comment.