diff options
| author | 2023-07-06 07:00:15 +0200 | |
|---|---|---|
| committer | 2023-07-06 07:00:15 +0200 | |
| commit | 7f805bc5dd9ed38c904d83f9ea931eed6f3234bf (patch) | |
| tree | 6f0b38ab20b8fa91e5bbcc001a5738bb83d5f20a /winit/src | |
| parent | a057f8811bfc47afc4271f05b92263a19122d888 (diff) | |
| parent | f350a2f812487af9a43c36e28d9b904e76a66474 (diff) | |
| download | iced-7f805bc5dd9ed38c904d83f9ea931eed6f3234bf.tar.gz iced-7f805bc5dd9ed38c904d83f9ea931eed6f3234bf.tar.bz2 iced-7f805bc5dd9ed38c904d83f9ea931eed6f3234bf.zip  | |
Merge pull request #1927 from thunderstorm010/master
Add command to retrieve window size
Diffstat (limited to '')
| -rw-r--r-- | winit/src/application.rs | 16 | 
1 files changed, 13 insertions, 3 deletions
diff --git a/winit/src/application.rs b/winit/src/application.rs index 6e7b94ef..d1689452 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -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);                  }  | 
