From 56d372ef0cf66d7960a8109c0563d5df817e458a Mon Sep 17 00:00:00 2001 From: "C.Even" Date: Sat, 26 Mar 2022 19:52:56 +0800 Subject: [PATCH] Fix project manager window centering in multi-monitor situation * When main screen's position in not (0,0) and editor scale is larger than 1, the project manager window was not centered in main screen --- editor/project_manager.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index d011d7a7e78..0879d0dd186 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -2872,10 +2872,11 @@ ProjectManager::ProjectManager() { if (scale_factor > 1.0) { 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; Vector2i window_position; - window_position.x = (screen_size.x - window_size.x) / 2; - window_position.y = (screen_size.y - window_size.y) / 2; + 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); }