@@ -149,7 +149,7 @@ void ProjectManager::_build_icon_type_cache(Ref<Theme> p_theme) {
149149
150150// Main layout.
151151
152- void ProjectManager::_update_size_limits () {
152+ void ProjectManager::_update_size_limits (bool p_custom_res ) {
153153 const Size2 minimum_size = Size2 (720 , 450 ) * EDSCALE;
154154 const Size2 default_size = Size2 (DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT) * EDSCALE;
155155
@@ -159,20 +159,21 @@ void ProjectManager::_update_size_limits() {
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- if (DisplayServer::get_singleton ()-> window_get_size () == default_size ) {
162+ if (!p_custom_res ) {
163163 // Only set window size if it currently matches the default, which is defined in `main/main.cpp`.
164164 // This allows CLI arguments to override the window size.
165165 w->set_size (default_size);
166166 DisplayServer::get_singleton ()->window_set_size (default_size);
167167 }
168168 }
169+ Size2 real_size = DisplayServer::get_singleton ()->window_get_size ();
169170
170171 Rect2i screen_rect = DisplayServer::get_singleton ()->screen_get_usable_rect (DisplayServer::get_singleton ()->window_get_current_screen ());
171172 if (screen_rect.size != Vector2i ()) {
172173 // Center the window on the screen.
173174 Vector2i window_position;
174- window_position.x = screen_rect.position .x + (screen_rect.size .x - default_size .x ) / 2 ;
175- window_position.y = screen_rect.position .y + (screen_rect.size .y - default_size .y ) / 2 ;
175+ window_position.x = screen_rect.position .x + (screen_rect.size .x - real_size .x ) / 2 ;
176+ window_position.y = screen_rect.position .y + (screen_rect.size .y - real_size .y ) / 2 ;
176177 DisplayServer::get_singleton ()->window_set_position (window_position);
177178
178179 // Limit popup menus to prevent unusably long lists.
@@ -1152,7 +1153,7 @@ void ProjectManager::_titlebar_resized() {
11521153
11531154// Object methods.
11541155
1155- ProjectManager::ProjectManager () {
1156+ ProjectManager::ProjectManager (bool p_custom_res ) {
11561157 singleton = this ;
11571158
11581159 set_translation_domain (" godot.editor" );
@@ -1740,7 +1741,7 @@ ProjectManager::ProjectManager() {
17401741 title_bar->connect (SceneStringName (item_rect_changed), callable_mp (this , &ProjectManager::_titlebar_resized));
17411742 }
17421743
1743- _update_size_limits ();
1744+ _update_size_limits (p_custom_res );
17441745}
17451746
17461747ProjectManager::~ProjectManager () {
0 commit comments