mirror of
https://github.com/danbulant/appit
synced 2026-05-19 12:18:50 +00:00
Window::request_inner_size
This commit is contained in:
parent
9f0b4a3c3e
commit
c985e024fc
2 changed files with 21 additions and 4 deletions
13
CHANGELOG.md
13
CHANGELOG.md
|
|
@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## Unreleased
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
- `Window::set_inner_size` has been replaced with `Window::request_inner_size`,
|
||||
and it matches the semantics of winit's underlying `request_inner_size`. The
|
||||
function returns an option containing the new size if the size was able to be
|
||||
applied before the function returns.
|
||||
|
||||
This new function properly updates the `inner_size` and `outer_size` when the
|
||||
underlying window is resized immediately. Notably, this happens on Wayland but
|
||||
may happen on some other platforms as well.
|
||||
|
||||
## v0.4.0 (2024-09-14)
|
||||
|
||||
### Breaking Changes
|
||||
|
|
|
|||
|
|
@ -397,10 +397,14 @@ where
|
|||
}
|
||||
|
||||
/// Sets the inner size of the window, in pixels.
|
||||
pub fn set_inner_size(&self, new_size: PhysicalSize<u32>) {
|
||||
// TODO not sure if this is reasonable
|
||||
self.window.set_min_inner_size(Some(new_size));
|
||||
self.window.set_max_inner_size(Some(new_size));
|
||||
#[must_use]
|
||||
pub fn request_inner_size(&mut self, new_size: PhysicalSize<u32>) -> Option<PhysicalSize<u32>> {
|
||||
let result = self.window.request_inner_size(new_size);
|
||||
if let Some(applied_size) = result {
|
||||
self.inner_size = applied_size;
|
||||
self.outer_size = self.window.outer_size();
|
||||
}
|
||||
result
|
||||
}
|
||||
|
||||
/// Returns the current outer size of the window, in pixels.
|
||||
|
|
|
|||
Loading…
Reference in a new issue