Add command to retrieve window size

This commit is contained in:
Yiğit Özdemir 2023-06-21 19:43:20 +03:00
parent 59bb5a99aa
commit 21a71b753d
No known key found for this signature in database
GPG key ID: 7FDC39C00954F1C7
4 changed files with 42 additions and 0 deletions

View file

@ -3,6 +3,7 @@
mod profiler;
mod state;
use iced_graphics::core::window::SizeType;
pub use state::State;
use crate::conversion;
@ -747,6 +748,21 @@ pub fn run_command<A, E>(
height,
});
}
window::Action::FetchSize {
size_type,
callback,
} => {
let width_height = match size_type {
SizeType::Inner => window.inner_size(),
SizeType::Outer => window.outer_size(),
};
let width_height =
(width_height.width, width_height.height);
proxy
.send_event(callback(width_height))
.expect("Send message to event loop")
}
window::Action::Maximize(maximized) => {
window.set_maximized(maximized);
}