From 8f86831da58ecd7525eefa34833659fb433c9bbb Mon Sep 17 00:00:00 2001 From: ShootingStarDragons Date: Sun, 6 Oct 2024 22:31:05 +0900 Subject: [PATCH] chore: adjust the field name of StartMode --- iced_examples/counter/src/main.rs | 2 +- iced_layershell/src/application.rs | 2 +- iced_layershell/src/settings.rs | 2 +- layershellev/src/lib.rs | 31 +++++++++++++++--------------- 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/iced_examples/counter/src/main.rs b/iced_examples/counter/src/main.rs index c5e9732..9104ccc 100644 --- a/iced_examples/counter/src/main.rs +++ b/iced_examples/counter/src/main.rs @@ -15,7 +15,7 @@ pub fn main() -> Result<(), iced_layershell::Error> { let start_mode = match binded_output_name { Some(output) => StartMode::TargetScreen(output), - None => StartMode::AllScreen, + None => StartMode::AllScreens, }; Counter::run(Settings { diff --git a/iced_layershell/src/application.rs b/iced_layershell/src/application.rs index 1984329..d4d3e48 100644 --- a/iced_layershell/src/application.rs +++ b/iced_layershell/src/application.rs @@ -151,7 +151,7 @@ where assert!(!matches!( settings.layer_settings.start_mode, - StartMode::AllScreen | StartMode::Background + StartMode::AllScreens | StartMode::Background )); let ev = layershellev::WindowStateSimple::new(&application.namespace()) diff --git a/iced_layershell/src/settings.rs b/iced_layershell/src/settings.rs index 26c4284..5047bac 100644 --- a/iced_layershell/src/settings.rs +++ b/iced_layershell/src/settings.rs @@ -129,7 +129,7 @@ mod tests { ); assert!(matches!( settings.layer_settings.start_mode, - StartMode::CurrentActive + StartMode::Active )); } diff --git a/layershellev/src/lib.rs b/layershellev/src/lib.rs index d3ac426..c9e746c 100644 --- a/layershellev/src/lib.rs +++ b/layershellev/src/lib.rs @@ -652,21 +652,21 @@ pub struct WindowWrapper { #[derive(Debug, Clone, Default, PartialEq, Eq)] pub enum StartMode { #[default] - CurrentActive, + Active, Background, - AllScreen, + AllScreens, TargetScreen(String), } impl StartMode { - pub fn is_current_active(&self) -> bool { - matches!(self, Self::CurrentActive) + pub fn is_active(&self) -> bool { + matches!(self, Self::Active) } pub fn is_background(&self) -> bool { matches!(self, Self::Background) } pub fn is_allscreen(&self) -> bool { - matches!(self, Self::AllScreen) + matches!(self, Self::AllScreens) } pub fn is_with_target(&self) -> bool { matches!(self, Self::TargetScreen(_)) @@ -714,17 +714,16 @@ impl WindowState { } self.main_window().gen_wrapper() } - #[allow(unused)] - fn is_current_active(&self) -> bool { - self.start_mode.is_current_active() + pub fn is_active(&self) -> bool { + self.start_mode.is_active() } - fn is_background(&self) -> bool { + pub fn is_background(&self) -> bool { self.start_mode.is_background() } - fn is_allscreen(&self) -> bool { + pub fn is_allscreen(&self) -> bool { self.start_mode.is_allscreen() } - fn is_with_target(&self) -> bool { + pub fn is_with_target(&self) -> bool { self.start_mode.is_with_target() } } @@ -796,7 +795,7 @@ impl WindowState { /// if the shell is a single one, only display on one screen, /// fi true, the layer will binding to current screen pub fn with_active(mut self) -> Self { - self.start_mode = StartMode::CurrentActive; + self.start_mode = StartMode::Active; self } @@ -822,15 +821,15 @@ impl WindowState { pub fn with_allscreen_or_active(mut self, allscreen: bool) -> Self { if allscreen { - self.start_mode = StartMode::AllScreen; + self.start_mode = StartMode::AllScreens; } else { - self.start_mode = StartMode::CurrentActive; + self.start_mode = StartMode::Active; } self } pub fn with_allscreen(mut self) -> Self { - self.start_mode = StartMode::AllScreen; + self.start_mode = StartMode::AllScreens; self } @@ -949,7 +948,7 @@ impl Default for WindowState { // is not binded xdg_info_cache: Vec::new(), - start_mode: StartMode::CurrentActive, + start_mode: StartMode::Active, init_finished: false, } }