[macOS] Simplify handling of menu accelerators, and send event to the focused window instead of main.

This commit is contained in:
bruvzg 2022-09-02 13:56:27 +03:00
parent 9142904c24
commit f255ecb241
No known key found for this signature in database
GPG Key ID: 7960FCF39844EC38
1 changed files with 1 additions and 12 deletions

View File

@ -59,18 +59,7 @@
} else {
// Otherwise redirect event to the engine.
if (DisplayServer::get_singleton()) {
DisplayServerMacOS::KeyEvent ke;
ke.window_id = DisplayServer::MAIN_WINDOW_ID;
ke.macos_state = [event modifierFlags];
ke.pressed = true;
ke.echo = [event isARepeat];
ke.keycode = KeyMappingMacOS::remap_key([event keyCode], [event modifierFlags]);
ke.physical_keycode = KeyMappingMacOS::translate_key([event keyCode]);
ke.raw = false;
ke.unicode = 0;
reinterpret_cast<DisplayServerMacOS *>(DisplayServer::get_singleton())->push_to_key_event_buffer(ke);
[[[NSApplication sharedApplication] keyWindow] sendEvent:event];
}
}