diff options
| author | HampusM <hampus@hampusmat.com> | 2026-06-11 17:30:17 +0200 |
|---|---|---|
| committer | HampusM <hampus@hampusmat.com> | 2026-06-11 17:30:17 +0200 |
| commit | 0918fd95082f3ad4837dec64e6c76d68f06da2fd (patch) | |
| tree | f243f088456a61fdc52a97ab2e42840850517d31 /engine/src/windowing.rs | |
| parent | 25bd2829b9927e2d5c17c657e6184d14e591a2fc (diff) | |
feat(engine): make window inner size modifiable
Diffstat (limited to 'engine/src/windowing.rs')
| -rw-r--r-- | engine/src/windowing.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/engine/src/windowing.rs b/engine/src/windowing.rs index 53e7bc3..0e2d1c3 100644 --- a/engine/src/windowing.rs +++ b/engine/src/windowing.rs @@ -223,7 +223,7 @@ fn update_stuff( ); } MessageFromApp::WindowResized(window_id, new_window_size) => { - tracing::debug!( + tracing::trace!( window_id = ?window_id, "Received window resized message" ); @@ -309,7 +309,7 @@ fn handle_window_changed( for evt_match in &observe { let window_ent_id = evt_match.entity_id(); - let window = evt_match.get_ent_target_comp(); + let mut window = evt_match.get_ent_target_comp_mut(); let Some((winit_window, _)) = context.windows.get(&window.wid()) else { tracing::error!( @@ -320,7 +320,11 @@ fn handle_window_changed( continue; }; - window.apply(winit_window); + let window_apply_results = window.apply(winit_window); + + if let Err(actual_window_inner_size) = window_apply_results.inner_size_request { + window.set_inner_size(actual_window_inner_size); + } context.try_send_message_to_app(MessageToApp::SetWindowCursorGrabMode( window.wid(), |
