Skip to content

Commit d9d6b4f

Browse files
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
1 parent 4046923 commit d9d6b4f

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

README.md

+10-4
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,11 @@ This is the mapping of `KeyCode` to a 102/105-key ISO keyboard:
7979

8080
The 102-key is missing `LWin`, `RWin`, and `Menu`.
8181

82+
(Reference: <https://kbdlayout.info/KBDUK/scancodes+virtualkeys?arrangement=ISO105>)
83+
8284
### 101/104 key ANSI
8385

84-
This is the mapping of `KeyCode` to a 101/104-key ANSI keyboard:
86+
This is the mapping of `KeyCode` to a 101/104-key ANSI keyboard:
8587

8688
```text
8789
┌────┐ ┌────┬────┬────┬────┐ ┌────┬────┬────┬────┐ ┌────┬────┬────┬────┐ ┌────┬────┬────┐
@@ -91,7 +93,7 @@ This is the mapping of `KeyCode` to a 101/104-key ANSI keyboard:
9193
┌────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬─────────┐ ┌────┬────┬────┐ ┌────┬────┬────┬────┐
9294
│Oem8│Key1│Key2│Key3│Key4│Key5│Key6│Key7│Key8│Key9│Key0│Oem─│Oem+│Backspace│ │Inse│Home│PgUp│ │NumL│Num/│Num*│Num─│
9395
├────┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬────────┤ ├────+────+────┤ ├────┼────┼────┼────┤
94-
│ Tab │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │Oem4│Oem6│ Oem5 │ │Dele│End │PgDo│ │Num7│Num8│Num9│ │
96+
│ Tab │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │Oem4│Oem6│ Oem7 │ │Dele│End │PgDo│ │Num7│Num8│Num9│ │
9597
├─────┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴────────┤ └────┴────┴────┘ ├────┼────┼────┤Num+│
9698
│CapsLo│ A │ S │ D │ F │ G │ H │ J │ K │ L │Oem1│Oem3│ Enter │ │Num4│Num5│Num6│ │
9799
├──────┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴────────────┤ ┌────┐ ├────┼────┼────┼────┤
@@ -101,10 +103,12 @@ This is the mapping of `KeyCode` to a 101/104-key ANSI keyboard:
101103
└─────┴─────┴─────┴──────────────────────────────┴─────┴─────┴──────┴──────┘ └────┴────┴────┘ └─────────┴────┴────┘
102104
```
103105

104-
Note that the `Oem7` key is missing on the 104-key ANSI keyboard.
106+
Note that the `Oem5` key is missing on the 104-key ANSI keyboard.
105107

106108
The 101-key is also missing `LWin`, `RWin`, and `Menu`.
107109

110+
(Reference: <https://kbdlayout.info/KBDUK/scancodes+virtualkeys?arrangement=ANSI104>)
111+
108112
### 106/109 key JIS
109113

110114
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:
129133

130134
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.
131135

132-
The 106-key is also missing `LWin`, `RWin`, and `Menu`.
136+
The 106-key is missing `LWin`, `RWin`, and `Menu`.
137+
138+
(Reference: <https://kbdlayout.info/KBDUK/scancodes+virtualkeys?arrangement=OADG109A>)
133139

134140
### Conversion Table
135141

src/layouts/us104.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ impl KeyboardLayout for Us104Key {
214214
DecodedKey::Unicode(']')
215215
}
216216
}
217-
KeyCode::Oem5 => {
217+
KeyCode::Oem7 => {
218218
if modifiers.is_shifted() {
219219
DecodedKey::Unicode('|')
220220
} else {
@@ -522,7 +522,7 @@ mod test {
522522
(0x19, 'p'),
523523
(0x1a, '['),
524524
(0x1b, ']'),
525-
(0x56, '\\'),
525+
(0x2b, '\\'),
526526
(0x1e, 'a'),
527527
(0x1f, 's'),
528528
(0x20, 'd'),

0 commit comments

Comments
 (0)