Skip to content

Commit

Permalink
Corrected layout of OEM keys.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jonathanpallant authored and thejpster committed Sep 13, 2024
1 parent 5c904e8 commit 42acef2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: <https://kbdlayout.info/KBDUK/scancodes+virtualkeys?arrangement=ISO105>)

### 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
┌────┐ ┌────┬────┬────┬────┐ ┌────┬────┬────┬────┐ ┌────┬────┬────┬────┐ ┌────┬────┬────┐
Expand All @@ -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│ │
├──────┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴────────────┤ ┌────┐ ├────┼────┼────┼────┤
Expand All @@ -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: <https://kbdlayout.info/KBDUK/scancodes+virtualkeys?arrangement=ANSI104>)

### 106/109 key JIS

This is the mapping of `KeyCode` to a 106/109-key JIS keyboard:
Expand All @@ -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: <https://kbdlayout.info/KBDUK/scancodes+virtualkeys?arrangement=OADG109A>)

### Conversion Table

Expand Down
4 changes: 2 additions & 2 deletions src/layouts/us104.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ impl KeyboardLayout for Us104Key {
DecodedKey::Unicode(']')
}
}
KeyCode::Oem5 => {
KeyCode::Oem7 => {
if modifiers.is_shifted() {
DecodedKey::Unicode('|')
} else {
Expand Down Expand Up @@ -522,7 +522,7 @@ mod test {
(0x19, 'p'),
(0x1a, '['),
(0x1b, ']'),
(0x56, '\\'),
(0x2b, '\\'),
(0x1e, 'a'),
(0x1f, 's'),
(0x20, 'd'),
Expand Down

0 comments on commit 42acef2

Please sign in to comment.