fix: dynamic mapping for non-overridden JIS characters

Signed-off-by: Amirhossein Akhlaghpour <m9.akhlaghpoor@gmail.com>
This commit is contained in:
Amirhossein Akhlaghpour 2026-05-16 20:46:59 +03:30
parent afc240ebe8
commit 0739b0e898
No known key found for this signature in database
GPG key ID: D7A35F11FB70A961

View file

@ -625,16 +625,19 @@ impl Enigo {
unsafe {
let (keyboard, _layout) = get_layout();
if !keyboard.is_null() {
let mut jis_code = u16::MAX;
let name_ref = TISGetInputSourceProperty(keyboard, kTISPropertyInputSourceID);
if !name_ref.is_null() {
if let Some(name) = get_string(name_ref as _) {
if name.contains("JIS") {
CFRelease(keyboard);
return self.map_key_board_jis(ch);
jis_code = self.map_key_board_jis(ch);
}
}
}
CFRelease(keyboard);
if jis_code != u16::MAX {
return jis_code;
}
}
}
@ -774,7 +777,7 @@ impl Enigo {
'/' => kVK_ANSI_Slash,
'`' => kVK_ANSI_Grave,
'"' => kVK_ANSI_2,
_ => self.map_key_board_en(ch),
_ => u16::MAX,
}
}