From 0341e6fc203b8aa777b92de58fed7da20459672b Mon Sep 17 00:00:00 2001 From: Ferdinand Schober Date: Fri, 23 Dec 2022 21:43:25 +0100 Subject: [PATCH] cleanup --- src/bin/server.rs | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/bin/server.rs b/src/bin/server.rs index 35b9b7c..206031a 100644 --- a/src/bin/server.rs +++ b/src/bin/server.rs @@ -34,7 +34,7 @@ use wayland_client::{ wl_buffer, wl_compositor, wl_keyboard, wl_pointer, wl_region, wl_registry, wl_seat, wl_shm, wl_shm_pool, wl_surface, }, - Connection, Dispatch, QueueHandle, WEnum, + Connection, Dispatch, QueueHandle, WEnum, delegate_dispatch, }; use tempfile; @@ -117,8 +117,8 @@ impl Window { fn main() { let config = lan_mouse::config::Config::new("config.toml").unwrap(); let connection = protocol::Connection::new(config); - let conn = Connection::connect_to_env().unwrap(); - let (g, mut queue) = registry_queue_init::(&conn).unwrap(); + let conn = Connection::connect_to_env().expect("could not connect to wayland compositor"); + let (g, mut queue) = registry_queue_init::(&conn).expect("failed to initialize wl_registry"); let qh = queue.handle(); let compositor: wl_compositor::WlCompositor = g @@ -388,17 +388,8 @@ impl Dispatch for App { } } -impl Dispatch for App { - fn event( - _: &mut App, - _: &wl_registry::WlRegistry, - _: wl_registry::Event, - _: &GlobalListContents, - _: &Connection, - _: &QueueHandle, - ) { - } -} +// delegate wl_registry events to App itself +delegate_dispatch!(App: [wl_registry::WlRegistry: GlobalListContents] => App); // don't emit any events delegate_noop!(App: wl_region::WlRegion);