summaryrefslogtreecommitdiff
path: root/editor/editor_run.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_run.cpp')
-rw-r--r--editor/editor_run.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/editor/editor_run.cpp b/editor/editor_run.cpp
index 749cf6aa2b..bbd18306a2 100644
--- a/editor/editor_run.cpp
+++ b/editor/editor_run.cpp
@@ -68,9 +68,24 @@ Error EditorRun::run(const String &p_scene, const String p_custom_args, const Li
int screen = EditorSettings::get_singleton()->get("run/window_placement/screen");
if (screen == 0) {
+ // Same as editor
screen = OS::get_singleton()->get_current_screen();
+ } else if (screen == 1) {
+ // Previous monitor (wrap to the other end if needed)
+ screen = Math::wrapi(
+ OS::get_singleton()->get_current_screen() - 1,
+ 0,
+ OS::get_singleton()->get_screen_count());
+ } else if (screen == 2) {
+ // Next monitor (wrap to the other end if needed)
+ screen = Math::wrapi(
+ OS::get_singleton()->get_current_screen() + 1,
+ 0,
+ OS::get_singleton()->get_screen_count());
} else {
- screen--;
+ // Fixed monitor ID
+ // There are 3 special options, so decrement the option ID by 3 to get the monitor ID
+ screen -= 3;
}
if (OS::get_singleton()->is_disable_crash_handler()) {
@@ -181,8 +196,8 @@ Error EditorRun::run(const String &p_scene, const String p_custom_args, const Li
void EditorRun::stop() {
if (status != STATUS_STOP && pid != 0) {
-
- OS::get_singleton()->kill(pid);
+ const int max_wait_msec = GLOBAL_DEF("editor/stop_max_wait_msec", 10000);
+ OS::get_singleton()->kill(pid, max_wait_msec);
}
status = STATUS_STOP;