Merge pull request #70863 from bruvzg/win_init_min

Set main window min. size via Window object instead of DisplayServer to preserve it during window updates.
This commit is contained in:
Rémi Verschelde 2023-01-09 23:08:52 +01:00
commit dce8cdbca8
No known key found for this signature in database
GPG Key ID: C3336907360768E1
4 changed files with 9 additions and 6 deletions

View File

@ -6093,7 +6093,10 @@ EditorNode::EditorNode() {
}
// Define a minimum window size to prevent UI elements from overlapping or being cut off.
DisplayServer::get_singleton()->window_set_min_size(Size2(1024, 600) * EDSCALE);
Window *w = Object::cast_to<Window>(SceneTree::get_singleton()->get_root());
if (w) {
w->set_min_size(Size2(1024, 600) * EDSCALE);
}
FileDialog::set_default_show_hidden_files(EDITOR_GET("filesystem/file_dialog/show_hidden_files"));
EditorFileDialog::set_default_show_hidden_files(EDITOR_GET("filesystem/file_dialog/show_hidden_files"));

View File

@ -3008,7 +3008,10 @@ ProjectManager::ProjectManager() {
SceneTree::get_singleton()->get_root()->connect("files_dropped", callable_mp(this, &ProjectManager::_files_dropped));
// Define a minimum window size to prevent UI elements from overlapping or being cut off.
DisplayServer::get_singleton()->window_set_min_size(Size2(520, 350) * EDSCALE);
Window *w = Object::cast_to<Window>(SceneTree::get_singleton()->get_root());
if (w) {
w->set_min_size(Size2(520, 350) * EDSCALE);
}
// Resize the bootsplash window based on Editor display scale EDSCALE.
float scale_factor = MAX(1, EDSCALE);

View File

@ -2769,10 +2769,6 @@ bool Main::start() {
DisplayServer::get_singleton()->window_set_title(appname);
#endif
// Define a very small minimum window size to prevent bugs such as GH-37242.
// It can still be overridden by the user in a script.
DisplayServer::get_singleton()->window_set_min_size(Size2i(64, 64));
bool snap_controls = GLOBAL_GET("gui/common/snap_controls_to_pixels");
sml->get_root()->set_snap_controls_to_pixels(snap_controls);

View File

@ -1396,6 +1396,7 @@ SceneTree::SceneTree() {
// Create with mainloop.
root = memnew(Window);
root->set_min_size(Size2i(64, 64)); // Define a very small minimum window size to prevent bugs such as GH-37242.
root->set_process_mode(Node::PROCESS_MODE_PAUSABLE);
root->set_name("root");
root->set_title(GLOBAL_GET("application/config/name"));