From 404692320e6811c0a4af8960e96f65ebd5819bc5 Mon Sep 17 00:00:00 2001 From: Jonathan Pallant Date: Fri, 13 Sep 2024 13:17:05 -0400 Subject: [PATCH 1/2] Fix keyboard ascii art. --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 85c5fb5..84a73c0 100644 --- a/README.md +++ b/README.md @@ -70,9 +70,9 @@ This is the mapping of `KeyCode` to a 102/105-key ISO keyboard: │ Tab │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │Oem4│Oem6│ Enter │ │Dele│End │PgDo│ │Num7│Num8│Num9│ │ ├─────┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┐ │ └────┴────┴────┘ ├────┼────┼────┤Num+│ │CapsLo│ A │ S │ D │ F │ G │ H │ J │ K │ L │Oem1│Oem3│Oem7│ │ │Num4│Num5│Num6│ │ -├────┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴────┴───────┤ ┌────┐ ├────┼────┼────┼────┤ -│LShf│Oem5│ Z │ X │ C │ V │ B │ N │ M │OemC│OemP│Oem2│ RShift │ │ Up │ │Num1│Num2│Num3│ │ -├────┴┬───┴─┬──┴──┬─┴────┴────┴────┴────┴────┴───┬┴────┴────┴┬──────┬──────┤ ┌────┼────┼────┐ ├────┴────┼────┤Num │ +├────┬─┴───┬┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴────┴───────┤ ┌────┐ ├────┼────┼────┼────┤ +│LShf│Oem5 │ Z │ X │ C │ V │ B │ N │ M │OemC│OemP│Oem2│ RShift │ │ Up │ │Num1│Num2│Num3│ │ +├────┴┬────┴┬──┴──┬─┴────┴────┴────┴────┴────┴───┬┴────┴────┴┬──────┬──────┤ ┌────┼────┼────┐ ├────┴────┼────┤Num │ │LCtrl│LWin │ Alt │ Space │AltGr│RWin │ Menu │RCtrl │ │Left│Down│Righ│ │Num0 │NumP│Ente│ └─────┴─────┴─────┴──────────────────────────────┴─────┴─────┴──────┴──────┘ └────┴────┴────┘ └─────────┴────┴────┘ ``` @@ -122,7 +122,7 @@ This is the mapping of `KeyCode` to a 106/109-key JIS keyboard: │CapsLo│ A │ S │ D │ F │ G │ H │ J │ K │ L │Oem1│Oem3│Oem7│ │ │Num4│Num5│Num6│ │ ├──────┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴────┴───────┤ ┌────┐ ├────┼────┼────┼────┤ │LShift │ Z │ X │ C │ V │ B │ N │ M │OemC│OemP│Oem2│Oem12 │RShift │ │ Up │ │Num1│Num2│Num3│ │ -├─────┬───┴─┬──┴──┬─┴───┬┴────┴────┴────┴────┴┬───┴─┬──┴──┬─┴──┬────┬──────┤ ┌────┼────┼────┐ ├────┴────┼────┤Num │ +├─────┬───┴─┬──┴──┬─┴───┬┴────┴────┴────┴────┴┬───┴─┬──┴──┬─┴──┬───┴┬──────┤ ┌────┼────┼────┐ ├────┴────┼────┤Num │ │LCtrl│LWin │LAlt │Oem9 │ Space Bar │Oem10│Oem11│RWin│Menu│RCtrl │ │Left│Down│Righ│ │Num0 │NumP│Ente│ └─────┴─────┴─────┴─────┴─────────────────────┴─────┴─────┴────┴────┴──────┘ └────┴────┴────┘ └─────────┴────┴────┘ ``` From d9d6b4f00eeeaa0440c90e93aac021563ff42195 Mon Sep 17 00:00:00 2001 From: Jonathan Pallant Date: Fri, 13 Sep 2024 13:40:43 -0400 Subject: [PATCH 2/2] Corrected layout of OEM keys. Now all placed according to their UK layout location, because we map scancode to KeyCode before considering the keyboard layout. Previously I referred to different layouts for ANSI104 and ISO105 and this introduced some errors. Closes #45 --- README.md | 14 ++++++++++---- src/layouts/us104.rs | 4 ++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 84a73c0..86fec61 100644 --- a/README.md +++ b/README.md @@ -79,9 +79,11 @@ This is the mapping of `KeyCode` to a 102/105-key ISO keyboard: The 102-key is missing `LWin`, `RWin`, and `Menu`. +(Reference: ) + ### 101/104 key ANSI -This is the mapping of `KeyCode` to a 101/104-key ANSI keyboard: +This is the mapping of `KeyCode` to a 101/104-key ANSI keyboard: ```text ┌────┐ ┌────┬────┬────┬────┐ ┌────┬────┬────┬────┐ ┌────┬────┬────┬────┐ ┌────┬────┬────┐ @@ -91,7 +93,7 @@ This is the mapping of `KeyCode` to a 101/104-key ANSI keyboard: ┌────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬─────────┐ ┌────┬────┬────┐ ┌────┬────┬────┬────┐ │Oem8│Key1│Key2│Key3│Key4│Key5│Key6│Key7│Key8│Key9│Key0│Oem─│Oem+│Backspace│ │Inse│Home│PgUp│ │NumL│Num/│Num*│Num─│ ├────┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬────────┤ ├────+────+────┤ ├────┼────┼────┼────┤ -│ Tab │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │Oem4│Oem6│ Oem5 │ │Dele│End │PgDo│ │Num7│Num8│Num9│ │ +│ Tab │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │Oem4│Oem6│ Oem7 │ │Dele│End │PgDo│ │Num7│Num8│Num9│ │ ├─────┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴────────┤ └────┴────┴────┘ ├────┼────┼────┤Num+│ │CapsLo│ A │ S │ D │ F │ G │ H │ J │ K │ L │Oem1│Oem3│ Enter │ │Num4│Num5│Num6│ │ ├──────┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴────────────┤ ┌────┐ ├────┼────┼────┼────┤ @@ -101,10 +103,12 @@ This is the mapping of `KeyCode` to a 101/104-key ANSI keyboard: └─────┴─────┴─────┴──────────────────────────────┴─────┴─────┴──────┴──────┘ └────┴────┴────┘ └─────────┴────┴────┘ ``` -Note that the `Oem7` key is missing on the 104-key ANSI keyboard. +Note that the `Oem5` key is missing on the 104-key ANSI keyboard. The 101-key is also missing `LWin`, `RWin`, and `Menu`. +(Reference: ) + ### 106/109 key JIS This is the mapping of `KeyCode` to a 106/109-key JIS keyboard: @@ -129,7 +133,9 @@ This is the mapping of `KeyCode` to a 106/109-key JIS keyboard: Note that the `Oem5` is missing on the 109-key JIS layout, but `Oem9` (Muhenkan), `Oem10` (Henkan/Zenkouho), `Oem11` (Hiragana/Katakana), `Oem12` (Backslash) and `Oem13` (¥) are added. -The 106-key is also missing `LWin`, `RWin`, and `Menu`. +The 106-key is missing `LWin`, `RWin`, and `Menu`. + +(Reference: ) ### Conversion Table diff --git a/src/layouts/us104.rs b/src/layouts/us104.rs index 9f2a04b..6bcf85f 100644 --- a/src/layouts/us104.rs +++ b/src/layouts/us104.rs @@ -214,7 +214,7 @@ impl KeyboardLayout for Us104Key { DecodedKey::Unicode(']') } } - KeyCode::Oem5 => { + KeyCode::Oem7 => { if modifiers.is_shifted() { DecodedKey::Unicode('|') } else { @@ -522,7 +522,7 @@ mod test { (0x19, 'p'), (0x1a, '['), (0x1b, ']'), - (0x56, '\\'), + (0x2b, '\\'), (0x1e, 'a'), (0x1f, 's'), (0x20, 'd'),