Skip to content

Commit

Permalink
chore: adjust the field name of StartMode
Browse files Browse the repository at this point in the history
  • Loading branch information
Decodetalkers committed Oct 6, 2024
1 parent 5c7bdee commit 8f86831
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 19 deletions.
2 changes: 1 addition & 1 deletion iced_examples/counter/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion iced_layershell/src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion iced_layershell/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ mod tests {
);
assert!(matches!(
settings.layer_settings.start_mode,
StartMode::CurrentActive
StartMode::Active
));
}

Expand Down
31 changes: 15 additions & 16 deletions layershellev/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(_))
Expand Down Expand Up @@ -714,17 +714,16 @@ impl<T> WindowState<T> {
}
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()
}
}
Expand Down Expand Up @@ -796,7 +795,7 @@ impl<T> WindowState<T> {
/// 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
}

Expand All @@ -822,15 +821,15 @@ impl<T> WindowState<T> {

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
}

Expand Down Expand Up @@ -949,7 +948,7 @@ impl<T> Default for WindowState<T> {
// is not binded
xdg_info_cache: Vec::new(),

start_mode: StartMode::CurrentActive,
start_mode: StartMode::Active,
init_finished: false,
}
}
Expand Down

0 comments on commit 8f86831

Please sign in to comment.