From 87673d7ecce661f3b8c5db949e70640934a55de9 Mon Sep 17 00:00:00 2001 From: MaxVerevkin Date: Thu, 7 Sep 2023 16:31:06 +0300 Subject: some refactoring --- src/state.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/state.rs') diff --git a/src/state.rs b/src/state.rs index c4fd0ce..92bf834 100644 --- a/src/state.rs +++ b/src/state.rs @@ -57,7 +57,7 @@ impl State { pub fn new( conn: &mut Connection, globals: &Globals, - event_loop: &mut EventLoop<(Connection, Self)>, + event_loop: &mut EventLoop, config_path: Option<&Path>, ) -> Self { let mut error = Ok(()); @@ -80,7 +80,10 @@ impl State { .map_err(|e| error = Err(e.into())) .ok(); - let wm_info_provider = wm_info_provider::bind(conn, globals, event_loop, &config.wm); + let wm_info_provider = wm_info_provider::bind(conn, globals, &config.wm); + if let Some(wm) = &wm_info_provider { + wm.register(event_loop); + } let mut this = Self { wl_compositor, @@ -155,7 +158,7 @@ impl State { } if let Some(wm) = &mut self.shared_state.wm_info_provider { - wm.new_ouput(conn, output.wl); + wm.new_ouput(conn, &output); } let mut bar = Bar::new(conn, self, output); @@ -174,7 +177,7 @@ impl State { pub fn drop_bar(&mut self, conn: &mut Connection, bar_index: usize) { let bar = self.bars.swap_remove(bar_index); if let Some(wm) = &mut self.shared_state.wm_info_provider { - wm.output_removed(conn, bar.output.wl); + wm.output_removed(conn, &bar.output); } bar.destroy(conn); } -- cgit v1.3.1