summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-08-22 22:26:52 +0200
committerGitHub <noreply@github.com>2018-08-22 22:26:52 +0200
commita752e2f4a370d82b5769f784bc030af4a61369c1 (patch)
treef50137dcca61684c42ece4e12ca62936a3a289a5 /editor
parent3fd2fc1e0159e480df6c1f01eea89a66ec89e67b (diff)
parent475a46c59cdc1d5abcd3a9f7441a0689847df186 (diff)
Merge pull request #21150 from Calinou/more-window-placement-options
Add more project window placement options
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_run.cpp17
-rw-r--r--editor/editor_settings.cpp2
2 files changed, 17 insertions, 2 deletions
diff --git a/editor/editor_run.cpp b/editor/editor_run.cpp
index 072bd948e1..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()) {
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 85186440ab..9278d7676a 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -494,7 +494,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("run/window_placement/rect", 1);
hints["run/window_placement/rect"] = PropertyInfo(Variant::INT, "run/window_placement/rect", PROPERTY_HINT_ENUM, "Top Left,Centered,Custom Position,Force Maximized,Force Fullscreen");
- String screen_hints = TTR("Default (Same as Editor)");
+ String screen_hints = "Same as Editor,Previous Monitor,Next Monitor";
for (int i = 0; i < OS::get_singleton()->get_screen_count(); i++) {
screen_hints += ",Monitor " + itos(i + 1);
}