defining first Display and Registry structs. Added Callback support for Registry.

This commit is contained in:
neo
2026-08-27 17:52:14 +02:00
parent ef2051c07f
commit 9ece322dc7
5 changed files with 267 additions and 14 deletions
+26
View File
@@ -0,0 +1,26 @@
// SPDIX-Licenes-Identifier: GPL-2.0-later
use std::io;
use wayland_client::display::Display;
fn main() -> io::Result<()> {
let display = Display::new(None)?;
let mut registry = display.get_registry();
// define on_global callback
registry.on_global(|interface, name, version|{
println!("interface: {interface}, version: {version}, name: {name}")
});
// define on_global_remove callback
registry.on_global_remove(|_name| {
// left blank
});
// register the callbacks in wayland
registry.registry_listener();
// take a look around
let _ = display.roundtrip();
drop(display);
Ok(())
}
+17
View File
@@ -0,0 +1,17 @@
// SPDX-License-Identifer: GPL-2.0-only
use std::io;
use wayland_client::display::Display;
fn main() -> io::Result<()> {
let display = Display::new(None)?;
println!("Connection established!");
while let Some(_events) = display.dispatch() {
}
drop(display);
Ok(())
}