mirror of
https://github.com/rust-windowing/winit.git
synced 2026-08-31 05:40:04 -04:00
Improve error when X11/Wayland is not present
This commit is contained in:
committed by
Kirill Chibisov
parent
85052c09bb
commit
0dc376a9ef
@@ -772,10 +772,15 @@ impl<T: 'static> EventLoop<T> {
|
|||||||
#[cfg(x11_platform)]
|
#[cfg(x11_platform)]
|
||||||
(None, _, true) => Backend::X,
|
(None, _, true) => Backend::X,
|
||||||
// No backend is present.
|
// No backend is present.
|
||||||
_ => {
|
(_, wayland_display, x11_display) => {
|
||||||
return Err(EventLoopError::Os(os_error!(OsError::Misc(
|
let msg = if wayland_display && !cfg!(wayland_platform) {
|
||||||
|
"DISPLAY is not set; note: enable the `winit/wayland` feature to support Wayland"
|
||||||
|
} else if x11_display && !cfg!(x11_platform) {
|
||||||
|
"WAYLAND_DISPLAY is not set; note: enable the `winit/x11` feature to support X11"
|
||||||
|
} else {
|
||||||
"neither WAYLAND_DISPLAY nor DISPLAY is set."
|
"neither WAYLAND_DISPLAY nor DISPLAY is set."
|
||||||
))));
|
};
|
||||||
|
return Err(EventLoopError::Os(os_error!(OsError::Misc(msg))));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user