[client] fix Wayland detection logic

$XDG_SESSION_TYPE is not guaranteed to be "wayland" when running on a
Wayland compositor. However, $WAYLAND_DISPLAY must always exist.
This commit is contained in:
Tudor Brindus 2021-01-03 20:57:58 -05:00 committed by Geoffrey McRae
parent f7d4efe1c1
commit 012ac950ac

View File

@ -1508,12 +1508,7 @@ static int lg_run()
if (g_cursor.sens < -9) g_cursor.sens = -9;
else if (g_cursor.sens > 9) g_cursor.sens = 9;
char* XDG_SESSION_TYPE = getenv("XDG_SESSION_TYPE");
if (XDG_SESSION_TYPE == NULL)
XDG_SESSION_TYPE = "unspecified";
if (strcmp(XDG_SESSION_TYPE, "wayland") == 0)
if (getenv("WAYLAND_DISPLAY"))
{
DEBUG_INFO("Wayland detected");
if (getenv("SDL_VIDEODRIVER") == NULL)