declared interfaces and more wrappers

This commit is contained in:
neo
2026-08-25 17:55:57 +02:00
parent aeab2375c8
commit 61cfcf283f
9 changed files with 235 additions and 23 deletions
+15 -6
View File
@@ -3,26 +3,35 @@ use std::io;
use wayland_server::client::Client;
use wayland_server::display::Display;
use wayland_server::global::{Global, GlobalState};
use wayland_server::interface::{Interface, Output};
use wayland_server::resource::Resource;
struct State {
output_interface: Interface<Output>,
}
impl State {
pub fn new() -> Self {
Self { output_interface: Interface::<Output>::new() }
}
}
impl GlobalState for State {
fn handle_output_bind(&self, client: Client, version: u32, id: u32) {
todo!()
fn handle_output_bind(&self, client: &Client, _version: u32, id: u32) -> io::Result<()>{
let resource = Resource::new(&client, id, &self.output_interface)?;
Ok(())
}
}
fn main() -> io::Result<()> {
// Creating a compositor State
let state = State {};
let state = State::new();
// create a wayland display
let display = Display::new()?;
// get the global registry
let global = Global::new(&display, state)?;
let _global = Global::new(&display, state)?;
println!("Running wayland_display on {}", display.get_name());