feat: SuggestedBounds event

This commit is contained in:
Ashley Wulber 2024-10-15 19:06:40 -04:00
parent b961e4877d
commit 66dc0eab25
No known key found for this signature in database
GPG key ID: 5216D4F46A90A820
3 changed files with 42 additions and 5 deletions

View file

@ -379,6 +379,22 @@ impl EventLoop {
}
}
if compositor_update.suggested_bounds {
let suggested_bounds = self.with_state(|state| {
let windows = state.windows.get_mut();
let window = windows.get(&window_id).unwrap().lock().unwrap();
window
.last_configure
.as_ref()
.and_then(|c| c.suggested_bounds)
.map(|b| dpi::PhysicalSize::new(b.0, b.1))
.clone()
});
let event = WindowEvent::SuggestedBounds(suggested_bounds);
app.window_event(&self.active_event_loop, window_id, event);
}
// NOTE: Rescale changed the physical size which winit operates in, thus we should
// resize.
if compositor_update.resized || compositor_update.scale_changed {