summaryrefslogtreecommitdiff
path: root/platform/macos
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2022-09-02 13:56:27 +0300
committerbruvzg <7645683+bruvzg@users.noreply.github.com>2022-09-02 13:56:27 +0300
commitf255ecb2413314583b927bb017ccab90f023bce0 (patch)
tree3b580aab8d00ba7b1bb509bb8b89826d294b6a90 /platform/macos
parent9142904c248cb4c9de8776f9abe995fc22335c2c (diff)
[macOS] Simplify handling of menu accelerators, and send event to the focused window instead of main.
Diffstat (limited to 'platform/macos')
-rw-r--r--platform/macos/godot_menu_delegate.mm13
1 files changed, 1 insertions, 12 deletions
diff --git a/platform/macos/godot_menu_delegate.mm b/platform/macos/godot_menu_delegate.mm
index bd394d8415..376f28d1d0 100644
--- a/platform/macos/godot_menu_delegate.mm
+++ b/platform/macos/godot_menu_delegate.mm
@@ -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];
}
}