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

@ -752,11 +752,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 {
@ -786,13 +786,24 @@ 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::GainFocus => {
window.focus_window();
}
window::Action::ChangeAlwaysOnTop(on_top) => {
window.set_always_on_top(on_top);
}
window::Action::FetchId(tag) => {
proxy
.send_event(tag(window.id().into()))
.expect("Send message to event loop");
}
},
command::Action::System(action) => match action {
system::Action::QueryInformation(_tag) => {

View file

@ -38,18 +38,18 @@ pub fn resize<Message>(
}
/// Maximizes the window.
pub fn maximize<Message>(id: window::Id, value: bool) -> Command<Message> {
pub fn maximize<Message>(id: window::Id, maximized: bool) -> Command<Message> {
Command::single(command::Action::Window(
id,
window::Action::Maximize(value),
window::Action::Maximize(maximized),
))
}
/// Minimes the window.
pub fn minimize<Message>(id: window::Id, value: bool) -> Command<Message> {
pub fn minimize<Message>(id: window::Id, minimized: bool) -> Command<Message> {
Command::single(command::Action::Window(
id,
window::Action::Minimize(value),
window::Action::Minimize(minimized),
))
}
@ -109,3 +109,20 @@ pub fn request_user_attention<Message>(
pub fn gain_focus<Message>(id: window::Id) -> Command<Message> {
Command::single(command::Action::Window(id, window::Action::GainFocus))
}
/// Changes whether or not the window will always be on top of other windows.
pub fn change_always_on_top<Message>(id: window::Id, on_top: bool) -> Command<Message> {
Command::single(command::Action::Window(id, window::Action::ChangeAlwaysOnTop(
on_top,
)))
}
/// Fetches an identifier unique to the window.
pub fn fetch_id<Message>(
id: window::Id,
f: impl FnOnce(u64) -> Message + 'static,
) -> Command<Message> {
Command::single(command::Action::Window(id: window::Id, window::Action::FetchId(Box::new(
f,
))))
}