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

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgrbr404 <166065505+grbr404@users.noreply.github.com>2025-05-29 15:08:15 +0200
committerGitHub <noreply@github.com>2025-05-29 15:08:15 +0200
commit55924a6b112435669458ddd1454f7ac691cb830e (patch)
tree46c39887bb74a9105bf4b3813c5abd0a135ef49a
parentc36f91a7c4b7a4cb1dacc11acdcc2f024b7c2fd6 (diff)
Check for Wayland to use it if the system uses it
Check for Wayland to use it if the system uses it
-rw-r--r--source/application/StarMainApplication_sdl.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/source/application/StarMainApplication_sdl.cpp b/source/application/StarMainApplication_sdl.cpp
index 941b344..953d3d8 100644
--- a/source/application/StarMainApplication_sdl.cpp
+++ b/source/application/StarMainApplication_sdl.cpp
@@ -282,6 +282,15 @@ public:
if (!m_platformServices)
Logger::info("Application: No platform services available");
+#ifdef STAR_SYSTEM_LINUX // Checks for Wayland and uses it if available, otherwise uses X11.
+ if (SDL_getenv("WAYLAND_DISPLAY") != nullptr) {
+ SDL_setenv("SDL_VIDEODRIVER", "wayland", 1);
+ Logger::info("Application: Using Wayland window system");
+ } else {
+ SDL_setenv("SDL_VIDEODRIVER", "x11", 1);
+ Logger::info("Application: Using X11 window system");
+ }
+
Logger::info("Application: Creating SDL Window");
m_sdlWindow = SDL_CreateWindow(m_windowTitle.utf8Ptr(), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
m_windowSize[0], m_windowSize[1], SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE);