瀏覽代碼

[macOS] Fix menu crash when used from opened native dialog.

bruvzg 1 年之前
父節點
當前提交
4c8f8e6980
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      platform/macos/godot_menu_delegate.mm

+ 5 - 1
platform/macos/godot_menu_delegate.mm

@@ -102,7 +102,11 @@
 					} else {
 						// Otherwise redirect event to the engine.
 						if (DisplayServer::get_singleton()) {
-							[[[NSApplication sharedApplication] keyWindow] sendEvent:event];
+							if ([[NSApplication sharedApplication] keyWindow].sheet) {
+								[[[[NSApplication sharedApplication] keyWindow] sheetParent] sendEvent:event];
+							} else {
+								[[[NSApplication sharedApplication] keyWindow] sendEvent:event];
+							}
 						}
 					}