summaryrefslogtreecommitdiff
path: root/core/os/os.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/os/os.cpp')
-rw-r--r--core/os/os.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/core/os/os.cpp b/core/os/os.cpp
index e90d714450..7547b6a042 100644
--- a/core/os/os.cpp
+++ b/core/os/os.cpp
@@ -30,13 +30,13 @@
#include "os.h"
-#include "dir_access.h"
-#include "input.h"
-#include "os/file_access.h"
-#include "os/midi_driver.h"
-#include "project_settings.h"
+#include "core/os/dir_access.h"
+#include "core/os/file_access.h"
+#include "core/os/input.h"
+#include "core/os/midi_driver.h"
+#include "core/project_settings.h"
+#include "core/version_generated.gen.h"
#include "servers/audio_server.h"
-#include "version_generated.gen.h"
#include <stdarg.h>
@@ -632,10 +632,13 @@ void OS::center_window() {
if (is_window_fullscreen()) return;
+ Point2 sp = get_screen_position(get_current_screen());
Size2 scr = get_screen_size(get_current_screen());
Size2 wnd = get_real_window_size();
- int x = scr.width / 2 - wnd.width / 2;
- int y = scr.height / 2 - wnd.height / 2;
+
+ int x = sp.width + (scr.width - wnd.width) / 2;
+ int y = sp.height + (scr.height - wnd.height) / 2;
+
set_window_position(Vector2(x, y));
}