Skip to content

Commit

Permalink
Make sure Window's title is respected before we compute the size
Browse files Browse the repository at this point in the history
Also removes some suspicious and outdated code that forced this particular
dialog to change size when the warning message changed.
  • Loading branch information
YuriSizov committed Nov 24, 2023
1 parent 1ba920f commit d9677be
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
7 changes: 1 addition & 6 deletions editor/project_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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.
Expand Down
10 changes: 4 additions & 6 deletions scene/main/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,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);

Expand Down Expand Up @@ -986,12 +990,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);
}
Expand Down

0 comments on commit d9677be

Please sign in to comment.