Skip to content

Commit

Permalink
Rename SetAlwaysOnTop to ChangeAlwaysOnTop
Browse files Browse the repository at this point in the history
  • Loading branch information
hecrj committed Feb 17, 2023
1 parent 095ecf0 commit df861d9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 19 deletions.
22 changes: 14 additions & 8 deletions native/src/window/action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ pub enum Action<T> {
/// ## Platform-specific
///
/// - **Web / Wayland:** Unsupported.
SetAlwaysOnTop(bool),
ChangeAlwaysOnTop(bool),
}

impl<T> Action<T> {
Expand All @@ -91,8 +91,8 @@ impl<T> Action<T> {
Self::Close => Action::Close,
Self::Drag => Action::Drag,
Self::Resize { width, height } => Action::Resize { width, height },
Self::Maximize(bool) => Action::Maximize(bool),
Self::Minimize(bool) => Action::Minimize(bool),
Self::Maximize(maximized) => Action::Maximize(maximized),
Self::Minimize(minimized) => Action::Minimize(minimized),
Self::Move { x, y } => Action::Move { x, y },
Self::ChangeMode(mode) => Action::ChangeMode(mode),
Self::FetchMode(o) => Action::FetchMode(Box::new(move |s| f(o(s)))),
Expand All @@ -102,7 +102,9 @@ impl<T> Action<T> {
Action::RequestUserAttention(attention_type)
}
Self::GainFocus => Action::GainFocus,
Self::SetAlwaysOnTop(bool) => Action::SetAlwaysOnTop(bool),
Self::ChangeAlwaysOnTop(on_top) => {
Action::ChangeAlwaysOnTop(on_top)
}
}
}
}
Expand All @@ -116,8 +118,12 @@ impl<T> fmt::Debug for Action<T> {
f,
"Action::Resize {{ widget: {width}, height: {height} }}"
),
Self::Maximize(value) => write!(f, "Action::Maximize({value})"),
Self::Minimize(value) => write!(f, "Action::Minimize({value}"),
Self::Maximize(maximized) => {
write!(f, "Action::Maximize({maximized})")
}
Self::Minimize(minimized) => {
write!(f, "Action::Minimize({minimized}")
}
Self::Move { x, y } => {
write!(f, "Action::Move {{ x: {x}, y: {y} }}")
}
Expand All @@ -129,8 +135,8 @@ impl<T> fmt::Debug for Action<T> {
write!(f, "Action::RequestUserAttention")
}
Self::GainFocus => write!(f, "Action::GainFocus"),
Self::SetAlwaysOnTop(value) => {
write!(f, "Action::AlwaysOnTop({})", value)
Self::ChangeAlwaysOnTop(on_top) => {
write!(f, "Action::AlwaysOnTop({on_top})")
}
}
}
Expand Down
25 changes: 14 additions & 11 deletions winit/src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -747,11 +747,11 @@ pub fn run_command<A, E>(
height,
});
}
window::Action::Maximize(value) => {
window.set_maximized(value);
window::Action::Maximize(maximized) => {
window.set_maximized(maximized);
}
window::Action::Minimize(value) => {
window.set_minimized(value);
window::Action::Minimize(minimized) => {
window.set_minimized(minimized);
}
window::Action::Move { x, y } => {
window.set_outer_position(winit::dpi::LogicalPosition {
Expand Down Expand Up @@ -781,15 +781,18 @@ pub fn run_command<A, E>(
window.set_maximized(!window.is_maximized())
}
window::Action::ToggleDecorations => {
window.set_decorations(!window.is_decorated())
window.set_decorations(!window.is_decorated());
}
window::Action::RequestUserAttention(user_attention) => window
.request_user_attention(
window::Action::RequestUserAttention(user_attention) => {
window.request_user_attention(
user_attention.map(conversion::user_attention),
),
window::Action::GainFocus => window.focus_window(),
window::Action::SetAlwaysOnTop(value) => {
window.set_always_on_top(value)
);
}
window::Action::GainFocus => {
window.focus_window();
}
window::Action::ChangeAlwaysOnTop(on_top) => {
window.set_always_on_top(on_top);
}
},
command::Action::System(action) => match action {
Expand Down

0 comments on commit df861d9

Please sign in to comment.