Merge pull request #1927 from thunderstorm010/master

Add command to retrieve window size
This commit is contained in:
Héctor Ramón 2023-07-06 07:00:15 +02:00 committed by GitHub
commit 7f805bc5dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 16 deletions

View file

@ -748,12 +748,22 @@ pub fn run_command<A, C, E>(
window::Action::Drag => {
let _res = window.drag_window();
}
window::Action::Resize { width, height } => {
window::Action::Resize(size) => {
window.set_inner_size(winit::dpi::LogicalSize {
width,
height,
width: size.width,
height: size.height,
});
}
window::Action::FetchSize(callback) => {
let size = window.inner_size();
proxy
.send_event(callback(Size::new(
size.width,
size.height,
)))
.expect("Send message to event loop")
}
window::Action::Maximize(maximized) => {
window.set_maximized(maximized);
}