Add initial work.

This commit is contained in:
Arthur Beck 2025-03-06 08:00:44 -06:00
parent c2297fdc48
commit 031c6076f1
Signed by: ArthurB
GPG key ID: ACE3D14F5CEF14BF
4 changed files with 45 additions and 0 deletions

5
.gitignore vendored
View file

@ -20,3 +20,8 @@ Cargo.lock
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
# Added by cargo
/target

3
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,3 @@
{
"rust-analyzer.check.command": "clippy"
}

8
Cargo.toml Normal file
View file

@ -0,0 +1,8 @@
[package]
name = "nuarth"
version = "0.1.0"
edition = "2024"
[dependencies]
polling = "3.7.4"
wayland-server = "0.31.7"

29
src/main.rs Normal file
View file

@ -0,0 +1,29 @@
//! 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.
}
}