From 511b4f822a26194800f408e40caa6192b909c56d Mon Sep 17 00:00:00 2001 From: Yuri Sizov Date: Fri, 24 Nov 2023 16:31:24 +0100 Subject: [PATCH] Make sure `Window`'s title is respected before we compute the size Also removes some suspicious and outdated code that forced this particular dialog to change size when the warning message changed. (cherry picked from commit d9677be0cab2274a4e53ac34783ba7539b52ab8f) --- editor/project_manager.cpp | 7 +------ scene/main/window.cpp | 10 ++++------ 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index ed011879473..291484600cf 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -101,12 +101,6 @@ void ProjectDialog::_set_message(const String &p_msg, MessageType p_type, InputT } else if (current_install_icon != new_icon && input_type == INSTALL_PATH) { install_status_rect->set_texture(new_icon); } - - Size2i window_size = get_size(); - Size2 contents_min_size = get_contents_minimum_size(); - if (window_size.x < contents_min_size.x || window_size.y < contents_min_size.y) { - set_size(window_size.max(contents_min_size)); - } } String ProjectDialog::_test_path() { @@ -868,6 +862,7 @@ ProjectDialog::ProjectDialog() { msg = memnew(Label); msg->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER); + msg->set_custom_minimum_size(Size2(200, 0) * EDSCALE); vb->add_child(msg); // Renderer selection. diff --git a/scene/main/window.cpp b/scene/main/window.cpp index afa69e0c496..a48a3367187 100644 --- a/scene/main/window.cpp +++ b/scene/main/window.cpp @@ -967,6 +967,10 @@ Size2i Window::_clamp_window_size(const Size2i &p_size) { void Window::_update_window_size() { Size2i size_limit = get_clamped_minimum_size(); + if (!embedder && window_id != DisplayServer::INVALID_WINDOW_ID && keep_title_visible) { + Size2i title_size = DisplayServer::get_singleton()->window_get_title_size(tr_title, window_id); + size_limit = size_limit.max(title_size); + } size = size.max(size_limit); @@ -998,12 +1002,6 @@ void Window::_update_window_size() { } DisplayServer::get_singleton()->window_set_max_size(max_size_used, window_id); - - if (keep_title_visible) { - Size2i title_size = DisplayServer::get_singleton()->window_get_title_size(tr_title, window_id); - size_limit = size_limit.max(title_size); - } - DisplayServer::get_singleton()->window_set_min_size(size_limit, window_id); DisplayServer::get_singleton()->window_set_size(size, window_id); }