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 d9677be0ca)
This commit is contained in:
Yuri Sizov 2023-11-24 16:31:24 +01:00 committed by Rémi Verschelde
parent d25e28d9ae
commit 511b4f822a
No known key found for this signature in database
GPG Key ID: C3336907360768E1
2 changed files with 5 additions and 12 deletions

View File

@ -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.

View File

@ -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);
}