@@ -1201,14 +1201,23 @@ fn handle_system_theme_changed(
fn parse_syskeydown_msg_keystroke(wparam: WPARAM) -> Option<Keystroke> {
let modifiers = current_modifiers();
+ let vk_code = wparam.loword();
+
+ // on Windows, F10 can trigger this event, not just the alt key,
+ // so when F10 was pressed, handle only it
if !modifiers.alt {
- // on Windows, F10 can trigger this event, not just the alt key
- // and we just don't care about F10
- return None;
+ if vk_code == VK_F10.0 {
+ let offset = vk_code - VK_F1.0;
+ return Some(Keystroke {
+ modifiers,
+ key: format!("f{}", offset + 1),
+ key_char: None,
+ });
+ } else {
+ return None;
+ }
}
- let vk_code = wparam.loword();
-
let key = match VIRTUAL_KEY(vk_code) {
VK_BACK => "backspace",
VK_RETURN => "enter",
@@ -1226,7 +1235,23 @@ fn parse_syskeydown_msg_keystroke(wparam: WPARAM) -> Option<Keystroke> {
VK_ESCAPE => "escape",
VK_INSERT => "insert",
VK_DELETE => "delete",
- _ => return basic_vkcode_to_string(vk_code, modifiers),
+ _ => {
+ let basic_key = basic_vkcode_to_string(vk_code, modifiers);
+ if basic_key.is_some() {
+ return basic_key;
+ } else {
+ if vk_code >= VK_F1.0 && vk_code <= VK_F24.0 {
+ let offset = vk_code - VK_F1.0;
+ return Some(Keystroke {
+ modifiers,
+ key: format!("f{}", offset + 1),
+ key_char: None,
+ });
+ } else {
+ return None;
+ }
+ }
+ }
}
.to_owned();