Merge remote-tracking branch 'origin/master' into feat/multi-window-support

# Conflicts:
#	winit/src/window.rs
This commit is contained in:
Bingus 2023-02-17 11:45:34 -08:00
commit 744cef5608
No known key found for this signature in database
GPG key ID: 5F84D2AA40A9F170
70 changed files with 807 additions and 542 deletions

View file

@ -75,6 +75,14 @@ pub enum Action<T> {
///
/// - **Web / Wayland:** Unsupported.
GainFocus,
/// Change whether or not the window will always be on top of other windows.
///
/// ## Platform-specific
///
/// - **Web / Wayland:** Unsupported.
ChangeAlwaysOnTop(bool),
/// Fetch an identifier unique to the window.
FetchId(Box<dyn FnOnce(u64) -> T + 'static>),
}
impl<T> Action<T> {
@ -91,8 +99,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)))),
@ -102,6 +110,10 @@ impl<T> Action<T> {
Action::RequestUserAttention(attention_type)
}
Self::GainFocus => Action::GainFocus,
Self::ChangeAlwaysOnTop(on_top) => {
Action::ChangeAlwaysOnTop(on_top)
}
Self::FetchId(o) => Action::FetchId(Box::new(move |s| f(o(s)))),
}
}
}
@ -118,8 +130,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} }}")
}
@ -131,6 +147,10 @@ impl<T> fmt::Debug for Action<T> {
write!(f, "Action::RequestUserAttention")
}
Self::GainFocus => write!(f, "Action::GainFocus"),
Self::ChangeAlwaysOnTop(on_top) => {
write!(f, "Action::AlwaysOnTop({on_top})")
}
Self::FetchId(_) => write!(f, "Action::FetchId"),
}
}
}