formatting commit
This commit is contained in:
parent
c46f327384
commit
d78a06123f
6 changed files with 131 additions and 97 deletions
|
|
@ -4,8 +4,8 @@ use crate::state::State;
|
|||
use anyhow::Result;
|
||||
use smithay::reexports::calloop::EventLoop;
|
||||
|
||||
pub mod x11;
|
||||
pub mod winit;
|
||||
pub mod x11;
|
||||
// TODO
|
||||
// pub mod wayland; // tbd in smithay
|
||||
// pub mod udev;
|
||||
|
|
@ -15,17 +15,21 @@ pub fn init_backend_auto(event_loop: &mut EventLoop<State>, state: &mut State) -
|
|||
Ok(x) if x == "x11" => x11::init_backend(event_loop, state),
|
||||
Ok(x) if x == "winit" => winit::init_backend(event_loop, state),
|
||||
Ok(_) => unimplemented!("There is no backend with this identifier"),
|
||||
Err(_) => if std::env::var_os("DISPLAY").is_some() || std::env::var_os("WAYLAND_DISPLAY").is_some() {
|
||||
match x11::init_backend(event_loop, state) {
|
||||
Ok(_) => Ok(()),
|
||||
Err(err) => {
|
||||
slog_scope::warn!("X11 Backend failed with error: {}", err);
|
||||
slog_scope::info!("Falling back to winit backend.");
|
||||
winit::init_backend(event_loop, state)
|
||||
Err(_) => {
|
||||
if std::env::var_os("DISPLAY").is_some()
|
||||
|| std::env::var_os("WAYLAND_DISPLAY").is_some()
|
||||
{
|
||||
match x11::init_backend(event_loop, state) {
|
||||
Ok(_) => Ok(()),
|
||||
Err(err) => {
|
||||
slog_scope::warn!("X11 Backend failed with error: {}", err);
|
||||
slog_scope::info!("Falling back to winit backend.");
|
||||
winit::init_backend(event_loop, state)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
unimplemented!("Currently this runs only nested")
|
||||
}
|
||||
} else {
|
||||
unimplemented!("Currently this runs only nested")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue