Fix EGLFS detection when a compositor is running on wayland-0 in another VT
This commit is contained in:
parent
39e24e9c8c
commit
f3f1d56e8d
1 changed files with 14 additions and 3 deletions
17
app/wm.cpp
17
app/wm.cpp
|
|
@ -145,9 +145,20 @@ bool WMUtils::isRunningWayland()
|
||||||
// If the value is not set yet, populate it now.
|
// If the value is not set yet, populate it now.
|
||||||
int val = SDL_AtomicGet(&isRunningOnWayland);
|
int val = SDL_AtomicGet(&isRunningOnWayland);
|
||||||
if (!(val & VALUE_SET)) {
|
if (!(val & VALUE_SET)) {
|
||||||
struct wl_display* display = wl_display_connect(nullptr);
|
struct wl_display* display = nullptr;
|
||||||
if (display != nullptr) {
|
|
||||||
wl_display_disconnect(display);
|
// We need to avoid the default fallback to wayland-0 that wl_display_connect()
|
||||||
|
// will try for cases where we might be running from a TTY with a Wayland
|
||||||
|
// compositor running in another VT that happens to use the wayland-0 name.
|
||||||
|
if (!qEnvironmentVariableIsEmpty("WAYLAND_DISPLAY") ||
|
||||||
|
!qEnvironmentVariableIsEmpty("WAYLAND_SOCKET") ||
|
||||||
|
qgetenv("XDG_SESSION_TYPE") == "wayland") {
|
||||||
|
|
||||||
|
// This looks like it might be a Wayland environment, so give it a shot
|
||||||
|
display = wl_display_connect(nullptr);
|
||||||
|
if (display != nullptr) {
|
||||||
|
wl_display_disconnect(display);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Populate the value to return and have for next time.
|
// Populate the value to return and have for next time.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue