Rename SetAlwaysOnTop to ChangeAlwaysOnTop
This commit is contained in:
parent
095ecf016b
commit
df861d9ece
2 changed files with 28 additions and 19 deletions
|
|
@ -75,7 +75,7 @@ pub enum Action<T> {
|
||||||
/// ## Platform-specific
|
/// ## Platform-specific
|
||||||
///
|
///
|
||||||
/// - **Web / Wayland:** Unsupported.
|
/// - **Web / Wayland:** Unsupported.
|
||||||
SetAlwaysOnTop(bool),
|
ChangeAlwaysOnTop(bool),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Action<T> {
|
impl<T> Action<T> {
|
||||||
|
|
@ -91,8 +91,8 @@ impl<T> Action<T> {
|
||||||
Self::Close => Action::Close,
|
Self::Close => Action::Close,
|
||||||
Self::Drag => Action::Drag,
|
Self::Drag => Action::Drag,
|
||||||
Self::Resize { width, height } => Action::Resize { width, height },
|
Self::Resize { width, height } => Action::Resize { width, height },
|
||||||
Self::Maximize(bool) => Action::Maximize(bool),
|
Self::Maximize(maximized) => Action::Maximize(maximized),
|
||||||
Self::Minimize(bool) => Action::Minimize(bool),
|
Self::Minimize(minimized) => Action::Minimize(minimized),
|
||||||
Self::Move { x, y } => Action::Move { x, y },
|
Self::Move { x, y } => Action::Move { x, y },
|
||||||
Self::ChangeMode(mode) => Action::ChangeMode(mode),
|
Self::ChangeMode(mode) => Action::ChangeMode(mode),
|
||||||
Self::FetchMode(o) => Action::FetchMode(Box::new(move |s| f(o(s)))),
|
Self::FetchMode(o) => Action::FetchMode(Box::new(move |s| f(o(s)))),
|
||||||
|
|
@ -102,7 +102,9 @@ impl<T> Action<T> {
|
||||||
Action::RequestUserAttention(attention_type)
|
Action::RequestUserAttention(attention_type)
|
||||||
}
|
}
|
||||||
Self::GainFocus => Action::GainFocus,
|
Self::GainFocus => Action::GainFocus,
|
||||||
Self::SetAlwaysOnTop(bool) => Action::SetAlwaysOnTop(bool),
|
Self::ChangeAlwaysOnTop(on_top) => {
|
||||||
|
Action::ChangeAlwaysOnTop(on_top)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -116,8 +118,12 @@ impl<T> fmt::Debug for Action<T> {
|
||||||
f,
|
f,
|
||||||
"Action::Resize {{ widget: {width}, height: {height} }}"
|
"Action::Resize {{ widget: {width}, height: {height} }}"
|
||||||
),
|
),
|
||||||
Self::Maximize(value) => write!(f, "Action::Maximize({value})"),
|
Self::Maximize(maximized) => {
|
||||||
Self::Minimize(value) => write!(f, "Action::Minimize({value}"),
|
write!(f, "Action::Maximize({maximized})")
|
||||||
|
}
|
||||||
|
Self::Minimize(minimized) => {
|
||||||
|
write!(f, "Action::Minimize({minimized}")
|
||||||
|
}
|
||||||
Self::Move { x, y } => {
|
Self::Move { x, y } => {
|
||||||
write!(f, "Action::Move {{ x: {x}, y: {y} }}")
|
write!(f, "Action::Move {{ x: {x}, y: {y} }}")
|
||||||
}
|
}
|
||||||
|
|
@ -129,8 +135,8 @@ impl<T> fmt::Debug for Action<T> {
|
||||||
write!(f, "Action::RequestUserAttention")
|
write!(f, "Action::RequestUserAttention")
|
||||||
}
|
}
|
||||||
Self::GainFocus => write!(f, "Action::GainFocus"),
|
Self::GainFocus => write!(f, "Action::GainFocus"),
|
||||||
Self::SetAlwaysOnTop(value) => {
|
Self::ChangeAlwaysOnTop(on_top) => {
|
||||||
write!(f, "Action::AlwaysOnTop({})", value)
|
write!(f, "Action::AlwaysOnTop({on_top})")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -747,11 +747,11 @@ pub fn run_command<A, E>(
|
||||||
height,
|
height,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
window::Action::Maximize(value) => {
|
window::Action::Maximize(maximized) => {
|
||||||
window.set_maximized(value);
|
window.set_maximized(maximized);
|
||||||
}
|
}
|
||||||
window::Action::Minimize(value) => {
|
window::Action::Minimize(minimized) => {
|
||||||
window.set_minimized(value);
|
window.set_minimized(minimized);
|
||||||
}
|
}
|
||||||
window::Action::Move { x, y } => {
|
window::Action::Move { x, y } => {
|
||||||
window.set_outer_position(winit::dpi::LogicalPosition {
|
window.set_outer_position(winit::dpi::LogicalPosition {
|
||||||
|
|
@ -781,15 +781,18 @@ pub fn run_command<A, E>(
|
||||||
window.set_maximized(!window.is_maximized())
|
window.set_maximized(!window.is_maximized())
|
||||||
}
|
}
|
||||||
window::Action::ToggleDecorations => {
|
window::Action::ToggleDecorations => {
|
||||||
window.set_decorations(!window.is_decorated())
|
window.set_decorations(!window.is_decorated());
|
||||||
}
|
}
|
||||||
window::Action::RequestUserAttention(user_attention) => window
|
window::Action::RequestUserAttention(user_attention) => {
|
||||||
.request_user_attention(
|
window.request_user_attention(
|
||||||
user_attention.map(conversion::user_attention),
|
user_attention.map(conversion::user_attention),
|
||||||
),
|
);
|
||||||
window::Action::GainFocus => window.focus_window(),
|
}
|
||||||
window::Action::SetAlwaysOnTop(value) => {
|
window::Action::GainFocus => {
|
||||||
window.set_always_on_top(value)
|
window.focus_window();
|
||||||
|
}
|
||||||
|
window::Action::ChangeAlwaysOnTop(on_top) => {
|
||||||
|
window.set_always_on_top(on_top);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
command::Action::System(action) => match action {
|
command::Action::System(action) => match action {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue