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

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2025-05-30 07:30:47 +1000
committerGitHub <noreply@github.com>2025-05-30 07:30:47 +1000
commitd4f886eed6015fcadc572092c6d5e8680bd11149 (patch)
treeadc304f135de5137c7e0affd3d84ef91bbc9a5a4
parente88912032d368a197ad92a33d18c26721c28ffe5 (diff)
parentf46e7a5124896125c2b25d5b26d54827736eb5d2 (diff)
Merge pull request #253 from grbr404/wayland/x11
Wayland/x11
-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()));