diff options
author | 2023-06-21 19:43:20 +0300 | |
---|---|---|
committer | 2023-06-21 19:43:20 +0300 | |
commit | 21a71b753d6da2233bce913f4e623ee14859ec23 (patch) | |
tree | 5293118e70f65b4f3805b508dad9a8185e260e32 /winit/src | |
parent | 59bb5a99aaefa13f01735e0b6b127fa498be902f (diff) | |
download | iced-21a71b753d6da2233bce913f4e623ee14859ec23.tar.gz iced-21a71b753d6da2233bce913f4e623ee14859ec23.tar.bz2 iced-21a71b753d6da2233bce913f4e623ee14859ec23.zip |
Add command to retrieve window size
Diffstat (limited to 'winit/src')
-rw-r--r-- | winit/src/application.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/winit/src/application.rs b/winit/src/application.rs index be416ac8..ff5afa69 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -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); } |