29 lines
1.1 KiB
Rust
29 lines
1.1 KiB
Rust
//! The main code for Nuarth.
|
|
#![warn(missing_docs, clippy::missing_docs_in_private_items)]
|
|
|
|
use polling::{Event, Poller};
|
|
|
|
/// The state of Nuarth.
|
|
struct State {}
|
|
|
|
fn main() {
|
|
let display = wayland_server::Display::<State>::new();
|
|
if display.is_err() {
|
|
println!("[FATAL] Cannot load libwayland-server.so, exiting.");
|
|
println!("[HINT] Compile Nuarth with wayland_server's dlopen feature disabled\n[HINT] to not require this library");
|
|
std::process::exit(1);
|
|
}
|
|
let mut display = display.unwrap(); // Error state is checked above
|
|
|
|
let polling_fd = display.backend().poll_fd();
|
|
let poller = Poller::new().unwrap(); // At the moment, this method cannot return an error.
|
|
unsafe { poller.add(&polling_fd, Event::readable(0)).unwrap(); } // At the moment, this method cannot return an error.
|
|
|
|
let mut events = polling::Events::new();
|
|
|
|
loop { // Event loop
|
|
events.clear();
|
|
poller.wait(&mut events, None).unwrap(); // At the moment, this method cannot return an error.
|
|
display.dispatch_clients(&mut State { }).unwrap(); // At the moment, this method cannot return an error.
|
|
}
|
|
}
|