modify keymap to match the keyboard

This commit is contained in:
2025-12-28 19:26:37 +01:00
parent d24abc6db2
commit 150c52f620

View File

@@ -101,11 +101,11 @@ pub enum KeyCode {
LeftCtrl = 0xE0, LeftCtrl = 0xE0,
LeftShift = 0xE1, LeftShift = 0xE1,
LeftAlt = 0xE2, LeftAlt = 0xE2,
LeftGui = 0xE3, LeftMeta = 0xE3,
RightCtrl = 0xE4, RightCtrl = 0xE4,
RightShift = 0xE5, RightShift = 0xE5,
RightAlt = 0xE6, // AltGr RightAlt = 0xE6, // AltGr
RightGui = 0xE7, RightMeta = 0xE7,
} }
impl KeyCode { impl KeyCode {
@@ -115,8 +115,8 @@ impl KeyCode {
pub const fn is_modifier(self) -> bool { pub const fn is_modifier(self) -> bool {
matches!(self, matches!(self,
KeyCode::LeftCtrl | KeyCode::LeftShift | KeyCode::LeftAlt | KeyCode::LeftGui | KeyCode::LeftCtrl | KeyCode::LeftShift | KeyCode::LeftAlt | KeyCode::LeftMeta |
KeyCode::RightCtrl | KeyCode::RightShift | KeyCode::RightAlt | KeyCode::RightGui KeyCode::RightCtrl | KeyCode::RightShift | KeyCode::RightAlt | KeyCode::RightMeta
) )
} }
@@ -125,11 +125,11 @@ impl KeyCode {
KeyCode::LeftCtrl => 0x01, KeyCode::LeftCtrl => 0x01,
KeyCode::LeftShift => 0x02, KeyCode::LeftShift => 0x02,
KeyCode::LeftAlt => 0x04, KeyCode::LeftAlt => 0x04,
KeyCode::LeftGui => 0x08, KeyCode::LeftMeta => 0x08,
KeyCode::RightCtrl => 0x10, KeyCode::RightCtrl => 0x10,
KeyCode::RightShift => 0x20, KeyCode::RightShift => 0x20,
KeyCode::RightAlt => 0x40, // AltGr KeyCode::RightAlt => 0x40, // AltGr
KeyCode::RightGui => 0x80, KeyCode::RightMeta => 0x80,
_ => 0, _ => 0,
} }
} }
@@ -144,9 +144,9 @@ pub const KEYMAP: [[KeyCode; 12]; 4] = [
KeyCode::I, KeyCode::O, KeyCode::P, KeyCode::Backspace, KeyCode::I, KeyCode::O, KeyCode::P, KeyCode::Backspace,
], ],
[ [
KeyCode::Tab, KeyCode::A, KeyCode::S, KeyCode::D, KeyCode::Tab, KeyCode::A, KeyCode::S, KeyCode::D,
KeyCode::F, KeyCode::G, KeyCode::H, KeyCode::J, KeyCode::F, KeyCode::G, KeyCode::H, KeyCode::J,
KeyCode::K, KeyCode::L, KeyCode::Quote, KeyCode::Enter, KeyCode::K, KeyCode::L, KeyCode::Semicolon, KeyCode::Enter,
], ],
[ [
KeyCode::LeftShift, KeyCode::Z, KeyCode::X, KeyCode::C, KeyCode::LeftShift, KeyCode::Z, KeyCode::X, KeyCode::C,
@@ -154,9 +154,9 @@ pub const KEYMAP: [[KeyCode; 12]; 4] = [
KeyCode::Comma, KeyCode::Dot, KeyCode::Up, KeyCode::Slash, KeyCode::Comma, KeyCode::Dot, KeyCode::Up, KeyCode::Slash,
], ],
[ [
KeyCode::LeftCtrl, KeyCode::No, KeyCode::No, KeyCode::LeftAlt, KeyCode::LeftCtrl, KeyCode::No, KeyCode::LeftMeta, KeyCode::LeftAlt,
KeyCode::No, KeyCode::Space, KeyCode::No, KeyCode::RightAlt, KeyCode::No, KeyCode::Space, KeyCode::No, KeyCode::No,
KeyCode::No, KeyCode::Left, KeyCode::Down, KeyCode::Right, KeyCode::RightAlt, KeyCode::Left, KeyCode::Down, KeyCode::Right,
], ],
]; ];