diff --git a/Source/Engine/Platform/SDL/SDLPlatform.Linux.cpp b/Source/Engine/Platform/SDL/SDLPlatform.Linux.cpp index 082e8868d..627bf4cb1 100644 --- a/Source/Engine/Platform/SDL/SDLPlatform.Linux.cpp +++ b/Source/Engine/Platform/SDL/SDLPlatform.Linux.cpp @@ -1602,6 +1602,11 @@ void SDLPlatform::SetHighDpiAwarenessEnabled(bool enable) bool SDLPlatform::UsesWayland() { + if (xDisplay == nullptr && WaylandDisplay == nullptr) + { + // In case the X11 display pointer has not been updated yet + return strcmp(SDL_GetCurrentVideoDriver(), "wayland") == 0; + } return WaylandDisplay != nullptr; } @@ -1617,6 +1622,11 @@ bool SDLPlatform::UsesXWayland() bool SDLPlatform::UsesX11() { + if (xDisplay == nullptr && WaylandDisplay == nullptr) + { + // In case the X11 display pointer has not been updated yet + return strcmp(SDL_GetCurrentVideoDriver(), "x11") == 0; + } return xDisplay != nullptr; }