mirror of
https://github.com/rust-windowing/winit.git
synced 2026-06-28 07:33:14 -04:00
Rename Window::set_inner_size to Window::request_inner_size
Some systems could resize the window immediately and we'd rather inform the users right away if that was the case, so they could create e.g. EGLSurface without waiting for resize, which is really important for Wayland. Fixes #2868.
This commit is contained in:
@@ -292,13 +292,14 @@ impl Window {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn set_inner_size(&self, size: Size) {
|
||||
// TODO should we issue the resize event? I don't think other platforms do so.
|
||||
pub fn request_inner_size(&self, size: Size) -> Option<PhysicalSize<u32>> {
|
||||
let mut window_state = self.window_state.lock().unwrap();
|
||||
let scale_factor = window_state.scale_factor();
|
||||
window_state.resize(size.to_logical::<u32>(scale_factor));
|
||||
|
||||
self.request_redraw();
|
||||
|
||||
Some(window_state.inner_size().to_physical(scale_factor))
|
||||
}
|
||||
|
||||
/// Set the minimum inner size for the window.
|
||||
|
||||
Reference in New Issue
Block a user