Merge pull request #57034 from bruvzg/fix_window_title_tr

This commit is contained in:
Rémi Verschelde 2022-01-21 15:25:16 +01:00 committed by GitHub
commit d7851b079e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 3 deletions

View file

@ -1328,6 +1328,8 @@ SceneTree::SceneTree() {
root = memnew(Window); root = memnew(Window);
root->set_process_mode(Node::PROCESS_MODE_PAUSABLE); root->set_process_mode(Node::PROCESS_MODE_PAUSABLE);
root->set_name("root"); root->set_name("root");
root->set_title(ProjectSettings::get_singleton()->get("application/config/name"));
#ifndef _3D_DISABLED #ifndef _3D_DISABLED
if (!root->get_world_3d().is_valid()) { if (!root->get_world_3d().is_valid()) {
root->set_world_3d(Ref<World3D>(memnew(World3D))); root->set_world_3d(Ref<World3D>(memnew(World3D)));

View file

@ -41,7 +41,16 @@ void Window::set_title(const String &p_title) {
if (embedder) { if (embedder) {
embedder->_sub_window_update(this); embedder->_sub_window_update(this);
} else if (window_id != DisplayServer::INVALID_WINDOW_ID) { } else if (window_id != DisplayServer::INVALID_WINDOW_ID) {
DisplayServer::get_singleton()->window_set_title(atr(p_title), window_id); String tr_title = atr(p_title);
#ifdef DEBUG_ENABLED
if (window_id == DisplayServer::MAIN_WINDOW_ID) {
// Append a suffix to the window title to denote that the project is running
// from a debug build (including the editor). Since this results in lower performance,
// this should be clearly presented to the user.
tr_title = vformat("%s (DEBUG)", tr_title);
}
#endif
DisplayServer::get_singleton()->window_set_title(tr_title, window_id);
} }
} }
@ -234,7 +243,16 @@ void Window::_make_window() {
DisplayServer::get_singleton()->window_set_current_screen(current_screen, window_id); DisplayServer::get_singleton()->window_set_current_screen(current_screen, window_id);
DisplayServer::get_singleton()->window_set_max_size(max_size, window_id); DisplayServer::get_singleton()->window_set_max_size(max_size, window_id);
DisplayServer::get_singleton()->window_set_min_size(min_size, window_id); DisplayServer::get_singleton()->window_set_min_size(min_size, window_id);
DisplayServer::get_singleton()->window_set_title(atr(title), window_id); String tr_title = atr(title);
#ifdef DEBUG_ENABLED
if (window_id == DisplayServer::MAIN_WINDOW_ID) {
// Append a suffix to the window title to denote that the project is running
// from a debug build (including the editor). Since this results in lower performance,
// this should be clearly presented to the user.
tr_title = vformat("%s (DEBUG)", tr_title);
}
#endif
DisplayServer::get_singleton()->window_set_title(tr_title, window_id);
DisplayServer::get_singleton()->window_attach_instance_id(get_instance_id(), window_id); DisplayServer::get_singleton()->window_attach_instance_id(get_instance_id(), window_id);
_update_window_size(); _update_window_size();
@ -773,7 +791,16 @@ void Window::_notification(int p_what) {
if (embedder) { if (embedder) {
embedder->_sub_window_update(this); embedder->_sub_window_update(this);
} else if (window_id != DisplayServer::INVALID_WINDOW_ID) { } else if (window_id != DisplayServer::INVALID_WINDOW_ID) {
DisplayServer::get_singleton()->window_set_title(atr(title), window_id); String tr_title = atr(title);
#ifdef DEBUG_ENABLED
if (window_id == DisplayServer::MAIN_WINDOW_ID) {
// Append a suffix to the window title to denote that the project is running
// from a debug build (including the editor). Since this results in lower performance,
// this should be clearly presented to the user.
tr_title = vformat("%s (DEBUG)", tr_title);
}
#endif
DisplayServer::get_singleton()->window_set_title(tr_title, window_id);
} }
child_controls_changed(); child_controls_changed();