summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Liebl <Bernhard.Liebl@gmx.org>2017-12-10 18:27:11 +0100
committerBernhard Liebl <Bernhard.Liebl@gmx.org>2017-12-10 18:28:08 +0100
commite161c47677f9c599d857d656e87f549ff844f290 (patch)
tree5c81192ce67f11f89b21c7a3197181a9e258b4c4
parent523237943cff1bb1b2b5e85289bb89455856437a (diff)
Fix player window centering on macOS retina screens
-rw-r--r--editor/editor_run.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/editor/editor_run.cpp b/editor/editor_run.cpp
index 90cbabcc4f..09bfa0aff0 100644
--- a/editor/editor_run.cpp
+++ b/editor/editor_run.cpp
@@ -101,7 +101,14 @@ Error EditorRun::run(const String &p_scene, const String p_custom_args, const Li
args.push_back(itos(screen_rect.position.x) + "," + itos(screen_rect.position.y));
} break;
case 1: { // centered
- Vector2 pos = screen_rect.position + ((screen_rect.size - desired_size) / 2).floor();
+ int display_scale = 1;
+#ifdef OSX_ENABLED
+ if (OS::get_singleton()->get_screen_dpi(screen) >= 192 && OS::get_singleton()->get_screen_size(screen).x > 2000) {
+ display_scale = 2;
+ }
+#endif
+
+ Vector2 pos = screen_rect.position + ((screen_rect.size / display_scale - desired_size) / 2).floor();
args.push_back("--position");
args.push_back(itos(pos.x) + "," + itos(pos.y));
} break;