mirror of
https://github.com/rust-windowing/winit.git
synced 2026-09-01 22:30:04 -04:00
Ensure that DISPLAY vars are non-empty before using
It's common to disable Wayland by `WAYLAND_DISPLAY= <application>`.
This commit is contained in:
@@ -752,11 +752,16 @@ impl<T: 'static> EventLoop<T> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: Wayland first because of X11 could be present under wayland as well.
|
// NOTE: Wayland first because of X11 could be present under Wayland as well. Empty
|
||||||
|
// variables are also treated as not set.
|
||||||
let backend = match (
|
let backend = match (
|
||||||
attributes.forced_backend,
|
attributes.forced_backend,
|
||||||
env::var("WAYLAND_DISPLAY").is_ok(),
|
env::var("WAYLAND_DISPLAY")
|
||||||
env::var("DISPLAY").is_ok(),
|
.map(|var| !var.is_empty())
|
||||||
|
.unwrap_or(false),
|
||||||
|
env::var("DISPLAY")
|
||||||
|
.map(|var| !var.is_empty())
|
||||||
|
.unwrap_or(false),
|
||||||
) {
|
) {
|
||||||
// User is forcing a backend.
|
// User is forcing a backend.
|
||||||
(Some(backend), _, _) => backend,
|
(Some(backend), _, _) => backend,
|
||||||
|
|||||||
Reference in New Issue
Block a user