Skip to content

Commit a173b0e

Browse files
committed
Merge pull request #91889 from Calinou/project-manager-tweak-default-window-size
Increase the project manager's default window size
2 parents abf8e1e + cc86322 commit a173b0e

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

editor/project_manager.cpp

+8-4
Original file line numberDiff line numberDiff line change
@@ -150,17 +150,21 @@ void ProjectManager::_build_icon_type_cache(Ref<Theme> p_theme) {
150150
// Main layout.
151151

152152
void ProjectManager::_update_size_limits() {
153-
const Size2 minimum_size = Size2(680, 450) * EDSCALE;
154-
const Size2 default_size = Size2(1024, 600) * EDSCALE;
153+
const Size2 minimum_size = Size2(720, 450) * EDSCALE;
154+
const Size2 default_size = Size2(DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT) * EDSCALE;
155155

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

166170
Rect2i screen_rect = DisplayServer::get_singleton()->screen_get_usable_rect(DisplayServer::get_singleton()->window_get_current_screen());

editor/project_manager.h

+3
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,9 @@ class ProjectManager : public Control {
250250
public:
251251
static ProjectManager *get_singleton() { return singleton; }
252252

253+
static constexpr int DEFAULT_WINDOW_WIDTH = 1152;
254+
static constexpr int DEFAULT_WINDOW_HEIGHT = 800;
255+
253256
// Project list.
254257

255258
bool is_initialized() const { return initialized; }

main/main.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -2459,6 +2459,15 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
24592459
OS::get_singleton()->set_current_rendering_driver_name(rendering_driver);
24602460
OS::get_singleton()->set_current_rendering_method(rendering_method);
24612461

2462+
#ifdef TOOLS_ENABLED
2463+
if (!force_res && project_manager) {
2464+
// Ensure splash screen size matches the project manager window size
2465+
// (see `editor/project_manager.cpp` for defaults).
2466+
window_size.width = ProjectManager::DEFAULT_WINDOW_WIDTH;
2467+
window_size.height = ProjectManager::DEFAULT_WINDOW_HEIGHT;
2468+
}
2469+
#endif
2470+
24622471
if (use_custom_res) {
24632472
if (!force_res) {
24642473
window_size.width = GLOBAL_GET("display/window/size/viewport_width");

0 commit comments

Comments
 (0)