Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/ci/linux/run-client.sh2
-rw-r--r--source/application/StarMainApplication_sdl.cpp14
2 files changed, 15 insertions, 1 deletions
diff --git a/scripts/ci/linux/run-client.sh b/scripts/ci/linux/run-client.sh
index 570e619..5cc2092 100755
--- a/scripts/ci/linux/run-client.sh
+++ b/scripts/ci/linux/run-client.sh
@@ -2,4 +2,6 @@
cd "`dirname \"$0\"`"
+export SDL_VIDEODRIVER=x11
+
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:./" ./starbound "$@" & exit
diff --git a/source/application/StarMainApplication_sdl.cpp b/source/application/StarMainApplication_sdl.cpp
index 941b344..c43aba7 100644
--- a/source/application/StarMainApplication_sdl.cpp
+++ b/source/application/StarMainApplication_sdl.cpp
@@ -257,11 +257,23 @@ public:
} catch (std::exception const& e) {
throw ApplicationException("Application threw exception during startup", e);
}
-
+
+#ifdef STAR_SYSTEM_LINUX // Checks for Wayland and uses it if available, otherwise uses X11.
+ if (SDL_getenv("SDL_VIDEODRIVER") == nullptr) {
+ if (SDL_getenv("WAYLAND_DISPLAY") != nullptr) {
+ SDL_setenv("SDL_VIDEODRIVER", "wayland", 1);
+ } else {
+ SDL_setenv("SDL_VIDEODRIVER", "x11", 1);
+ }
+ }
+#endif
+
Logger::info("Application: Initializing SDL Video");
if (SDL_InitSubSystem(SDL_INIT_VIDEO))
throw ApplicationException(strf("Couldn't initialize SDL Video: {}", SDL_GetError()));
+ Logger::info("Application: using Video Driver '{}'", SDL_GetCurrentVideoDriver());
+
Logger::info("Application: Initializing SDL Controller");
if (SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER))
throw ApplicationException(strf("Couldn't initialize SDL Controller: {}", SDL_GetError()));