From 0344cde98fed859f30103b1f25d49b79e15aed55 Mon Sep 17 00:00:00 2001 From: Ari Vuollet Date: Thu, 25 Jul 2024 21:34:28 +0300 Subject: [PATCH] Add command-line switches to force X11 and Wayland SDL drivers --- Source/Engine/Engine/CommandLine.cpp | 7 +++++++ Source/Engine/Engine/CommandLine.h | 14 ++++++++++++++ Source/Engine/Platform/SDL/SDLPlatform.cpp | 2 ++ 3 files changed, 23 insertions(+) diff --git a/Source/Engine/Engine/CommandLine.cpp b/Source/Engine/Engine/CommandLine.cpp index c1d1a8540..645b0bfc6 100644 --- a/Source/Engine/Engine/CommandLine.cpp +++ b/Source/Engine/Engine/CommandLine.cpp @@ -146,6 +146,13 @@ bool CommandLine::Parse(const Char* cmdLine) PARSE_BOOL_SWITCH("-mute ", Mute); PARSE_BOOL_SWITCH("-lowdpi ", LowDPI); +#if PLATFORM_LINUX && PLATFORM_SDL + + PARSE_BOOL_SWITCH("-wayland ", Wayland); + PARSE_BOOL_SWITCH("-x11 ", X11); + +#endif + #if USE_EDITOR PARSE_BOOL_SWITCH("-clearcache ", ClearCache); diff --git a/Source/Engine/Engine/CommandLine.h b/Source/Engine/Engine/CommandLine.h index 039349770..4d4947bd0 100644 --- a/Source/Engine/Engine/CommandLine.h +++ b/Source/Engine/Engine/CommandLine.h @@ -127,6 +127,20 @@ public: /// Nullable LowDPI; +#if PLATFORM_LINUX && PLATFORM_SDL + + /// + /// -wayland (prefer Wayland over X11 as display server) + /// + Nullable Wayland; + + /// + /// -x11 (prefer X11 over Wayland as display server) + /// + Nullable X11; + +#endif + #if USE_EDITOR /// diff --git a/Source/Engine/Platform/SDL/SDLPlatform.cpp b/Source/Engine/Platform/SDL/SDLPlatform.cpp index 89aa246a1..30d82962a 100644 --- a/Source/Engine/Platform/SDL/SDLPlatform.cpp +++ b/Source/Engine/Platform/SDL/SDLPlatform.cpp @@ -102,6 +102,8 @@ void SDLPlatform::LogInfo() LOG(Info, "Using SDL version {}.{}.{} ({}), runtime: {}.{}.{} ({})", SDL_VERSIONNUM_MAJOR(SDL_VERSION), SDL_VERSIONNUM_MINOR(SDL_VERSION), SDL_VERSIONNUM_MICRO(SDL_VERSION), String(SDL_REVISION), SDL_VERSIONNUM_MAJOR(runtimeVersion), SDL_VERSIONNUM_MINOR(runtimeVersion), SDL_VERSIONNUM_MICRO(runtimeVersion), String(SDL_GetRevision())); + + LOG(Info, "SDL video driver: {}", String(SDL_GetCurrentVideoDriver())); } bool SDLPlatform::CheckWindowDragging(Window* window, WindowHitCodes hit)