Skip to content

Commit

Permalink
feat(win): map (no)convert scancodes (#1166)
Browse files Browse the repository at this point in the history
Try adding code for previously-unmapped JIS keys. Not tested. #1160.
  • Loading branch information
jtroo authored Aug 4, 2024
1 parent 4a8268f commit f51b8df
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/oskbd/windows/interception_convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,8 @@ impl TryFrom<OsCodeWrapper> for Stroke {
// ScanCode::Help => 0x63,
// ScanCode::AltPrintScreen = 0x55, /* Alt + print screen. */
// ScanCode::SBCSChar = 0x77,
// ScanCode::Convert = 0x79,
// ScanCode::NonConvert = 0x7B,
OsCode::KEY_HENKAN => (ScanCode::Convert, KeyState::empty()),
OsCode::KEY_MUHENKAN => (ScanCode::NonConvert, KeyState::empty()),
OsCode::KEY_PREVIOUSSONG => (ScanCode::Q, KeyState::E0),
OsCode::KEY_NEXTSONG => (ScanCode::P, KeyState::E0), // 0x19
OsCode::KEY_KPENTER => (ScanCode::Enter, KeyState::E0), // 0x1C
Expand Down
5 changes: 3 additions & 2 deletions src/oskbd/windows/scancode_to_usvk.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use kanata_parser::keys::OsCode;

#[rustfmt::skip]
#[allow(unused)]
pub fn u16_to_osc(input: u16) -> Option<OsCode> {
Some(if input < 0xE000 {
Expand Down Expand Up @@ -103,6 +104,8 @@ pub fn u16_to_osc(input: u16) -> Option<OsCode> {
0x6E => OsCode::KEY_F23,
0x76 => OsCode::KEY_F24,
0x70 => OsCode::KEY_KATAKANA,
0x79 => OsCode::KEY_HENKAN, // Convert
0x7B => OsCode::KEY_MUHENKAN, // Noconvert
// Note: the OEM keys below don't seem to correspond to the same VK OEM
// mappings as the LLHOOK codes.
// ScanCode::Oem1 = 0x5A, /* VK_OEM_WSCTRL */
Expand All @@ -117,8 +120,6 @@ pub fn u16_to_osc(input: u16) -> Option<OsCode> {
// ScanCode::Help => 0x63,
// ScanCode::AltPrintScreen = 0x55, /* Alt + print screen. */
// ScanCode::SBCSChar = 0x77,
// ScanCode::Convert = 0x79,
// ScanCode::NonConvert = 0x7B,
_ => return None,
}
} else {
Expand Down

0 comments on commit f51b8df

Please sign in to comment.