Bug 1720497 - Do not require MOZ_ENABLE_WAYLAND if Xwayland is not available, r=stransky

If `WAYLAND_DISPLAY` is set but `DISPLAY` is not, we have every reason
to assume that we are in a Wayland-only session. Enable the Wayland
backend unconditionally in this case.

Note: We do not bother to further sanity check the content of the env
variables as these can be considered client setup bugs.

Differential Revision: https://phabricator.services.mozilla.com/D120216
This commit is contained in:
Robert Mader 2021-07-19 20:26:00 +00:00
Родитель a3a8d74a08
Коммит 68d9686d94
1 изменённых файлов: 2 добавлений и 1 удалений

Просмотреть файл

@ -4081,9 +4081,10 @@ bool IsWaylandEnabled() {
return false;
}
const char* x11Display = PR_GetEnv("DISPLAY");
// MOZ_ENABLE_WAYLAND is our primary Wayland on/off switch.
const char* waylandPref = PR_GetEnv("MOZ_ENABLE_WAYLAND");
bool enableWayland = (waylandPref && *waylandPref);
bool enableWayland = !x11Display || (waylandPref && *waylandPref);
if (!enableWayland) {
const char* backendPref = PR_GetEnv("GDK_BACKEND");
enableWayland = (backendPref && strncmp(backendPref, "wayland", 7) == 0);