summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-03-27 10:36:49 +0200
committerGitHub <noreply@github.com>2022-03-27 10:36:49 +0200
commitc0f707d2ec9048a1af9e6b441664eab0f48de2c7 (patch)
tree055031e264317ee89e78ce6bcff35e0984f0ef47
parentf0407ad14de5e8c4c668ba4e6a983d2211022d9a (diff)
parent536d7581bac51b72481c78cd4763558ed387c977 (diff)
Merge pull request #59535 from floppyhammer/fix-project-manager-window-size
Fix project manager window size not applying display scale correctly
-rw-r--r--editor/project_manager.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index 0879d0dd18..cd95f97286 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -2873,10 +2873,16 @@ ProjectManager::ProjectManager() {
Vector2i window_size = DisplayServer::get_singleton()->window_get_size();
Vector2i screen_size = DisplayServer::get_singleton()->screen_get_size();
Vector2i screen_position = DisplayServer::get_singleton()->screen_get_position();
- window_size *= scale_factor;
+
+ // Consider the editor display scale.
+ window_size.x = round((float)window_size.x * scale_factor);
+ window_size.y = round((float)window_size.y * scale_factor);
+
+ // Make the window centered on the screen.
Vector2i window_position;
window_position.x = screen_position.x + (screen_size.x - window_size.x) / 2;
window_position.y = screen_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);
}