DisplayServer (Linux): don't rely on $XDG_SESSION_TYPE for detecting wm protocol

Fix #1162
This commit is contained in:
Carter Li
2024-08-06 16:34:01 +08:00
parent 1361e8cd18
commit 8396f000e1
@@ -46,9 +46,7 @@ static void getWMProtocolNameFromEnv(FFDisplayServerResult* result)
void ffConnectDisplayServerImpl(FFDisplayServerResult* ds)
{
getWMProtocolNameFromEnv(ds);
if (!ffStrbufEqualS(&ds->wmProtocolName, FF_WM_PROTOCOL_TTY) &&instance.config.general.dsForceDrm == FF_DS_FORCE_DRM_TYPE_FALSE)
if (instance.config.general.dsForceDrm == FF_DS_FORCE_DRM_TYPE_FALSE)
{
//We try wayland as our preferred display server, as it supports the most features.
//This method can't detect the name of our WM / DE
@@ -96,6 +94,9 @@ void ffConnectDisplayServerImpl(FFDisplayServerResult* ds)
}
#endif
if (ds->wmProtocolName.length == 0)
getWMProtocolNameFromEnv(ds);
if(!ffStrbufEqualS(&ds->wmProtocolName, FF_WM_PROTOCOL_TTY))
{
//This fills in missing information about WM / DE by using env vars and iterating processes