summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/os/main_loop.cpp2
-rw-r--r--core/os/main_loop.h6
-rw-r--r--editor/editor_node.h2
-rw-r--r--platform/osx/os_osx.mm7
-rw-r--r--scene/main/scene_tree.cpp14
5 files changed, 29 insertions, 2 deletions
diff --git a/core/os/main_loop.cpp b/core/os/main_loop.cpp
index 248f5537c6..6d07e2a39c 100644
--- a/core/os/main_loop.cpp
+++ b/core/os/main_loop.cpp
@@ -54,6 +54,8 @@ void MainLoop::_bind_methods() {
BIND_CONSTANT(NOTIFICATION_WM_QUIT_REQUEST);
BIND_CONSTANT(NOTIFICATION_WM_UNFOCUS_REQUEST);
BIND_CONSTANT(NOTIFICATION_OS_MEMORY_WARNING);
+ BIND_CONSTANT(NOTIFICATION_TRANSLATION_CHANGED);
+ BIND_CONSTANT(NOTIFICATION_WM_ABOUT);
};
void MainLoop::set_init_script(const Ref<Script> &p_init_script) {
diff --git a/core/os/main_loop.h b/core/os/main_loop.h
index 23b352468e..a0125ec13c 100644
--- a/core/os/main_loop.h
+++ b/core/os/main_loop.h
@@ -56,7 +56,11 @@ public:
NOTIFICATION_WM_GO_BACK_REQUEST = 7,
NOTIFICATION_WM_UNFOCUS_REQUEST = 8,
NOTIFICATION_OS_MEMORY_WARNING = 9,
- NOTIFICATION_TRANSLATION_CHANGED = 10,
+ // Note: NOTIFICATION_TRANSLATION_CHANGED and NOTIFICATION_WM_ABOUT used to have id=10 and id=11 but these
+ // conflict with NOTIFICATION_ENTER_TREE (id=10) and NOTIFICATION_EXIT_TREE (id=11), so id=90 and id=91
+ // fixes this issue.
+ NOTIFICATION_TRANSLATION_CHANGED = 90,
+ NOTIFICATION_WM_ABOUT = 91,
};
virtual void input_event(const Ref<InputEvent> &p_event);
diff --git a/editor/editor_node.h b/editor/editor_node.h
index cf6ef33325..385d97ecc3 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -684,6 +684,8 @@ public:
void merge_from_scene() { _menu_option_confirm(FILE_IMPORT_SUBSCENE, false); }
+ void show_about() { _menu_option_confirm(HELP_ABOUT, false); }
+
static bool has_unsaved_changes() { return singleton->unsaved_cache; }
static HBoxContainer *get_menu_hb() { return singleton->menu_hb; }
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 33b1e64dd4..34f1a93f3b 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -137,6 +137,11 @@ static bool mouse_down_control = false;
//_GodotInputMonitorChange();
}
+- (void)showAbout:(id)sender {
+ if (OS_OSX::singleton->get_main_loop())
+ OS_OSX::singleton->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_ABOUT);
+}
+
@end
@interface GodotWindowDelegate : NSObject {
@@ -1902,7 +1907,7 @@ OS_OSX::OS_OSX() {
// Setup Apple menu
NSMenu *apple_menu = [[NSMenu alloc] initWithTitle:@""];
title = [NSString stringWithFormat:NSLocalizedString(@"About %@", nil), nsappname];
- [apple_menu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];
+ [apple_menu addItemWithTitle:title action:@selector(showAbout:) keyEquivalent:@""];
[apple_menu addItem:[NSMenuItem separatorItem]];
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index 66f3d7d627..da324c45a4 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -38,6 +38,7 @@
#include <stdio.h>
//#include "servers/spatial_sound_2d_server.h"
+#include "editor/editor_node.h"
#include "io/marshalls.h"
#include "io/resource_loader.h"
#include "scene/resources/material.h"
@@ -626,6 +627,19 @@ void SceneTree::_notification(int p_notification) {
} break;
+ case NOTIFICATION_WM_ABOUT: {
+
+#ifdef TOOLS_ENABLED
+ if (is_editor_hint()) {
+ EditorNode::get_singleton()->show_about();
+ } else {
+#endif
+ get_root()->propagate_notification(p_notification);
+#ifdef TOOLS_ENABLED
+ }
+#endif
+ } break;
+
default:
break;
};