Merge pull request #59542 from fountainment/fix_pm_window_pos

This commit is contained in:
Rémi Verschelde 2022-03-26 15:51:40 +01:00 committed by GitHub
commit cd43ab38d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -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);
}