From f6e91b9622db2a5772a0bf6bc6006c6f5a3eff4a Mon Sep 17 00:00:00 2001 From: MaxVerevkin Date: Thu, 7 Sep 2023 17:42:38 +0300 Subject: more refactoring --- src/wm_info_provider.rs | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'src/wm_info_provider.rs') diff --git a/src/wm_info_provider.rs b/src/wm_info_provider.rs index 25eef05..59e0511 100644 --- a/src/wm_info_provider.rs +++ b/src/wm_info_provider.rs @@ -10,6 +10,9 @@ use crate::pointer_btn::PointerBtn; use crate::protocol::*; use crate::state::State; +mod dummy; +pub use dummy::*; + mod river; pub use river::*; @@ -22,7 +25,9 @@ pub trait WmInfoProvider { fn new_ouput(&mut self, _: &mut Connection, _: &Output) {} fn output_removed(&mut self, _: &mut Connection, _: &Output) {} - fn get_tags(&self, output: &Output) -> Vec; + fn get_tags(&self, _: &Output) -> Vec { + Vec::new() + } fn get_layout_name(&self, _: &Output) -> Option { None } @@ -32,12 +37,13 @@ pub trait WmInfoProvider { fn click_on_tag( &mut self, - conn: &mut Connection, - output: WlOutput, - seat: WlSeat, - tag_id: u32, - btn: PointerBtn, - ); + _conn: &mut Connection, + _output: WlOutput, + _seat: WlSeat, + _tag_id: u32, + _btn: PointerBtn, + ) { + } fn as_any(&mut self) -> &mut dyn Any; } @@ -46,16 +52,16 @@ pub fn bind( conn: &mut Connection, globals: &Globals, config: &WmConfig, -) -> Option> { +) -> Box { if let Some(river) = RiverInfoProvider::bind(conn, globals, config) { - return Some(Box::new(river)); + return Box::new(river); } - if let Some(hyprland) = Hyprland::new() { - return Some(Box::new(hyprland)); + if let Some(hyprland) = HyprlandInfoProvider::new() { + return Box::new(hyprland); } - None + Box::new(DummyInfoProvider) } #[derive(Debug)] -- cgit v1.3.1