Merge pull request #87498 from bruvzg/mac_fix_mod_space_events

[macOS] Fix missing modifier + space key down events.
This commit is contained in:
Yuri Sizov 2024-01-24 14:08:48 +01:00
commit 47ec590af8

View file

@ -576,11 +576,7 @@
String u32text; String u32text;
u32text.parse_utf16(text.ptr(), text.length()); u32text.parse_utf16(text.ptr(), text.length());
for (int i = 0; i < u32text.length(); i++) {
const char32_t codepoint = u32text[i];
DisplayServerMacOS::KeyEvent ke; DisplayServerMacOS::KeyEvent ke;
ke.window_id = window_id; ke.window_id = window_id;
ke.macos_state = [event modifierFlags]; ke.macos_state = [event modifierFlags];
ke.pressed = true; ke.pressed = true;
@ -588,9 +584,15 @@
ke.keycode = KeyMappingMacOS::remap_key([event keyCode], [event modifierFlags], false); ke.keycode = KeyMappingMacOS::remap_key([event keyCode], [event modifierFlags], false);
ke.physical_keycode = KeyMappingMacOS::translate_key([event keyCode]); ke.physical_keycode = KeyMappingMacOS::translate_key([event keyCode]);
ke.key_label = KeyMappingMacOS::remap_key([event keyCode], [event modifierFlags], true); ke.key_label = KeyMappingMacOS::remap_key([event keyCode], [event modifierFlags], true);
ke.unicode = fix_unicode(codepoint);
ke.raw = true; ke.raw = true;
if (u32text.is_empty()) {
ke.unicode = 0;
ds->push_to_key_event_buffer(ke);
}
for (int i = 0; i < u32text.length(); i++) {
const char32_t codepoint = u32text[i];
ke.unicode = fix_unicode(codepoint);
ds->push_to_key_event_buffer(ke); ds->push_to_key_event_buffer(ke);
} }
} else { } else {