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

summaryrefslogtreecommitdiff
path: root/source/application/StarMainApplication_sdl.cpp
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 /source/application/StarMainApplication_sdl.cpp
parente88912032d368a197ad92a33d18c26721c28ffe5 (diff)
parentf46e7a5124896125c2b25d5b26d54827736eb5d2 (diff)
Merge pull request #253 from grbr404/wayland/x11
Wayland/x11
Diffstat (limited to 'source/application/StarMainApplication_sdl.cpp')
-rw-r--r--source/application/StarMainApplication_sdl.cpp14
1 files changed, 13 insertions, 1 deletions
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()));