summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-02-13 10:37:48 +0100
committerGitHub <noreply@github.com>2022-02-13 10:37:48 +0100
commite9ef64526afb00b93e8d585ee2ece866684781a7 (patch)
tree1889e80137cd9bbcea9a44354e0c1c2ab9c3a468
parent72243894681f16c51d8848b4aeea1518d595c2a2 (diff)
parentf3b7419790a176105e40c9b9e181ee3d0ed4929e (diff)
Merge pull request #57892 from TechnicalSoup/ProjManager-Patch
Center initial position of project manager window
-rw-r--r--editor/project_manager.cpp25
1 files changed, 16 insertions, 9 deletions
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index 3ca25bb4e3..2a9f699ee6 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -2525,15 +2525,6 @@ ProjectManager::ProjectManager() {
editor_set_scale(EditorSettings::get_singleton()->get("interface/editor/custom_display_scale"));
break;
}
-
- // Define a minimum window size to prevent UI elements from overlapping or being cut off
- DisplayServer::get_singleton()->window_set_min_size(Size2(750, 420) * EDSCALE);
-
- // TODO: Resize windows on hiDPI displays on Windows and Linux and remove the lines below
- float scale_factor = MAX(1, EDSCALE);
- Vector2i window_size = DisplayServer::get_singleton()->window_get_size();
- DisplayServer::get_singleton()->window_set_size(Vector2i(window_size.x * scale_factor, window_size.y * scale_factor));
-
EditorFileDialog::get_icon_func = &ProjectManager::_file_dialog_get_icon;
}
@@ -2868,6 +2859,22 @@ 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(750, 420) * EDSCALE);
+
+ // Resize the bootsplash window based on Editor display scale EDSCALE.
+ float scale_factor = MAX(1, EDSCALE);
+ if (scale_factor > 1.0) {
+ Vector2i window_size = DisplayServer::get_singleton()->window_get_size();
+ Vector2i screen_size = DisplayServer::get_singleton()->screen_get_size();
+ window_size *= scale_factor;
+ Vector2i window_position;
+ window_position.x = (screen_size.x - window_size.x) / 2;
+ window_position.y = (screen_size.y - window_size.y) / 2;
+ DisplayServer::get_singleton()->window_set_size(window_size);
+ DisplayServer::get_singleton()->window_set_position(window_position);
+ }
+
OS::get_singleton()->set_low_processor_usage_mode(true);
}