summaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorRiteo <riteo@posteo.net>2024-02-07 14:11:19 +0100
committerRiteo <riteo@posteo.net>2024-02-07 16:49:21 +0100
commit2677af779415fac6ddca13025ce63418657f6107 (patch)
tree277eb02c187ac73fd00c3a80b18f0f9583f24e36 /main
parent36e943b6b20cb7a8a89bc30489c4a81c3e149d74 (diff)
downloadredot-engine-2677af779415fac6ddca13025ce63418657f6107.tar.gz
Handle display driver preferences consistently between editor and projects
The way that it was implemented before allowed for the project property to spill over to the editor if the `prefer_wayland` property is not present which, while not completely likely, is still a possibility. This specific part is thus more of a correctness change, ensuring that we always enforce the default display server when not running a project. This commit also removes the restart requirement for the relative display driver project settings as they're independent and a restart would do nothing useful.
Diffstat (limited to 'main')
-rw-r--r--main/main.cpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/main/main.cpp b/main/main.cpp
index bc2a6107b5..b9baa3c5c3 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -2209,12 +2209,12 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
// Make sure that headless is the last one, which it is assumed to be by design.
DEV_ASSERT(NULL_DISPLAY_DRIVER == DisplayServer::get_create_function_name(DisplayServer::get_create_function_count() - 1));
- GLOBAL_DEF_RST_NOVAL("display/display_server/driver", "default");
- GLOBAL_DEF_RST_NOVAL(PropertyInfo(Variant::STRING, "display/display_server/driver.windows", PROPERTY_HINT_ENUM_SUGGESTION, "default,windows,headless"), "default");
- GLOBAL_DEF_RST_NOVAL(PropertyInfo(Variant::STRING, "display/display_server/driver.linuxbsd", PROPERTY_HINT_ENUM_SUGGESTION, "default,x11,wayland,headless"), "default");
- GLOBAL_DEF_RST_NOVAL(PropertyInfo(Variant::STRING, "display/display_server/driver.android", PROPERTY_HINT_ENUM_SUGGESTION, "default,android,headless"), "default");
- GLOBAL_DEF_RST_NOVAL(PropertyInfo(Variant::STRING, "display/display_server/driver.ios", PROPERTY_HINT_ENUM_SUGGESTION, "default,iOS,headless"), "default");
- GLOBAL_DEF_RST_NOVAL(PropertyInfo(Variant::STRING, "display/display_server/driver.macos", PROPERTY_HINT_ENUM_SUGGESTION, "default,macos,headless"), "default");
+ GLOBAL_DEF_NOVAL("display/display_server/driver", "default");
+ GLOBAL_DEF_NOVAL(PropertyInfo(Variant::STRING, "display/display_server/driver.windows", PROPERTY_HINT_ENUM_SUGGESTION, "default,windows,headless"), "default");
+ GLOBAL_DEF_NOVAL(PropertyInfo(Variant::STRING, "display/display_server/driver.linuxbsd", PROPERTY_HINT_ENUM_SUGGESTION, "default,x11,wayland,headless"), "default");
+ GLOBAL_DEF_NOVAL(PropertyInfo(Variant::STRING, "display/display_server/driver.android", PROPERTY_HINT_ENUM_SUGGESTION, "default,android,headless"), "default");
+ GLOBAL_DEF_NOVAL(PropertyInfo(Variant::STRING, "display/display_server/driver.ios", PROPERTY_HINT_ENUM_SUGGESTION, "default,iOS,headless"), "default");
+ GLOBAL_DEF_NOVAL(PropertyInfo(Variant::STRING, "display/display_server/driver.macos", PROPERTY_HINT_ENUM_SUGGESTION, "default,macos,headless"), "default");
GLOBAL_DEF_RST_NOVAL("audio/driver/driver", AudioDriverManager::get_driver(0)->get_name());
if (audio_driver.is_empty()) { // Specified in project.godot.
@@ -2462,6 +2462,7 @@ Error Main::setup2() {
String screen_property;
bool prefer_wayland_found = false;
+ bool prefer_wayland = false;
if (editor) {
screen_property = "interface/editor/editor_screen";
@@ -2494,16 +2495,17 @@ Error Main::setup2() {
}
if (!prefer_wayland_found && assign == "run/platforms/linuxbsd/prefer_wayland") {
- if (value) {
- display_driver = "wayland";
- } else {
- display_driver = "default";
- }
-
+ prefer_wayland = value;
prefer_wayland_found = true;
}
}
}
+
+ if (prefer_wayland) {
+ display_driver = "wayland";
+ } else {
+ display_driver = "default";
+ }
}
}
}