Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase the project manager's default window size #91889

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions editor/project_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,17 +150,21 @@ void ProjectManager::_build_icon_type_cache(Ref<Theme> p_theme) {
// Main layout.

void ProjectManager::_update_size_limits() {
const Size2 minimum_size = Size2(680, 450) * EDSCALE;
const Size2 default_size = Size2(1024, 600) * EDSCALE;
const Size2 minimum_size = Size2(720, 450) * EDSCALE;
const Size2 default_size = Size2(DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT) * EDSCALE;

// Define a minimum window size to prevent UI elements from overlapping or being cut off.
Window *w = Object::cast_to<Window>(SceneTree::get_singleton()->get_root());
if (w) {
// Calling Window methods this early doesn't sync properties with DS.
w->set_min_size(minimum_size);
DisplayServer::get_singleton()->window_set_min_size(minimum_size);
w->set_size(default_size);
DisplayServer::get_singleton()->window_set_size(default_size);
if (DisplayServer::get_singleton()->window_get_size() == default_size) {
// Only set window size if it currently matches the default, which is defined in `main/main.cpp`.
// This allows CLI arguments to override the window size.
w->set_size(default_size);
DisplayServer::get_singleton()->window_set_size(default_size);
}
}

Rect2i screen_rect = DisplayServer::get_singleton()->screen_get_usable_rect(DisplayServer::get_singleton()->window_get_current_screen());
Expand Down
3 changes: 3 additions & 0 deletions editor/project_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,9 @@ class ProjectManager : public Control {
public:
static ProjectManager *get_singleton() { return singleton; }

static constexpr int DEFAULT_WINDOW_WIDTH = 1152;
static constexpr int DEFAULT_WINDOW_HEIGHT = 800;

// Project list.

bool is_initialized() const { return initialized; }
Expand Down
9 changes: 9 additions & 0 deletions main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2459,6 +2459,15 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
OS::get_singleton()->set_current_rendering_driver_name(rendering_driver);
OS::get_singleton()->set_current_rendering_method(rendering_method);

#ifdef TOOLS_ENABLED
if (!force_res && project_manager) {
// Ensure splash screen size matches the project manager window size
// (see `editor/project_manager.cpp` for defaults).
window_size.width = ProjectManager::DEFAULT_WINDOW_WIDTH;
window_size.height = ProjectManager::DEFAULT_WINDOW_HEIGHT;
}
Comment on lines +2463 to +2468
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you are doing this anyway, can you have it initialize EDSCALE earlier and have the initial size take it into account?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be done in a separate PR as per @badsectoracula's comment (it's quite a bit more complex).

#endif

if (use_custom_res) {
if (!force_res) {
window_size.width = GLOBAL_GET("display/window/size/viewport_width");
Expand Down