Rename "inner size" to "surface size" (#3889)
* Rename `WindowEvent::Resized` to `SurfaceResized` * Rename `InnerSizeWriter` to `SurfaceSizeWriter` * Replace `inner_size` with `surface_size` * Rename `resize_increments` to `surface_resize_increments`
This commit is contained in:
parent
d37c591378
commit
8db3e0e043
32 changed files with 466 additions and 436 deletions
|
|
@ -389,7 +389,7 @@ impl ApplicationHandler for Application {
|
|||
};
|
||||
|
||||
match event {
|
||||
WindowEvent::Resized(size) => {
|
||||
WindowEvent::SurfaceResized(size) => {
|
||||
window.resize(size);
|
||||
},
|
||||
WindowEvent::Focused(focused) => {
|
||||
|
|
@ -607,7 +607,7 @@ impl WindowState {
|
|||
let ime = true;
|
||||
window.set_ime_allowed(ime);
|
||||
|
||||
let size = window.inner_size();
|
||||
let size = window.surface_size();
|
||||
let mut state = Self {
|
||||
#[cfg(macos_platform)]
|
||||
option_as_alt: window.option_as_alt(),
|
||||
|
|
@ -681,12 +681,12 @@ impl WindowState {
|
|||
|
||||
/// Toggle resize increments on a window.
|
||||
fn toggle_resize_increments(&mut self) {
|
||||
let new_increments = match self.window.resize_increments() {
|
||||
let new_increments = match self.window.surface_resize_increments() {
|
||||
Some(_) => None,
|
||||
None => Some(LogicalSize::new(25.0, 25.0).into()),
|
||||
};
|
||||
info!("Had increments: {}", new_increments.is_none());
|
||||
self.window.set_resize_increments(new_increments);
|
||||
self.window.set_surface_resize_increments(new_increments);
|
||||
}
|
||||
|
||||
/// Toggle fullscreen.
|
||||
|
|
@ -725,22 +725,22 @@ impl WindowState {
|
|||
self.window.set_option_as_alt(self.option_as_alt);
|
||||
}
|
||||
|
||||
/// Swap the window dimensions with `request_inner_size`.
|
||||
/// Swap the window dimensions with `request_surface_size`.
|
||||
fn swap_dimensions(&mut self) {
|
||||
let old_inner_size = self.window.inner_size();
|
||||
let mut inner_size = old_inner_size;
|
||||
let old_surface_size = self.window.surface_size();
|
||||
let mut surface_size = old_surface_size;
|
||||
|
||||
mem::swap(&mut inner_size.width, &mut inner_size.height);
|
||||
info!("Requesting resize from {old_inner_size:?} to {inner_size:?}");
|
||||
mem::swap(&mut surface_size.width, &mut surface_size.height);
|
||||
info!("Requesting resize from {old_surface_size:?} to {surface_size:?}");
|
||||
|
||||
if let Some(new_inner_size) = self.window.request_inner_size(inner_size.into()) {
|
||||
if old_inner_size == new_inner_size {
|
||||
if let Some(new_surface_size) = self.window.request_surface_size(surface_size.into()) {
|
||||
if old_surface_size == new_surface_size {
|
||||
info!("Inner size change got ignored");
|
||||
} else {
|
||||
self.resize(new_inner_size);
|
||||
self.resize(new_surface_size);
|
||||
}
|
||||
} else {
|
||||
info!("Request inner size is asynchronous");
|
||||
info!("Requesting surface size is asynchronous");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -793,9 +793,9 @@ impl WindowState {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Resize the window to the new size.
|
||||
/// Resize the surface to the new size.
|
||||
fn resize(&mut self, size: PhysicalSize<u32>) {
|
||||
info!("Resized to {size:?}");
|
||||
info!("Surface resized to {size:?}");
|
||||
#[cfg(not(any(android_platform, ios_platform)))]
|
||||
{
|
||||
let (width, height) = match (NonZeroU32::new(size.width), NonZeroU32::new(size.height))
|
||||
|
|
@ -840,7 +840,7 @@ impl WindowState {
|
|||
},
|
||||
};
|
||||
|
||||
let win_size = self.window.inner_size();
|
||||
let win_size = self.window.surface_size();
|
||||
let border_size = BORDER_SIZE * self.window.scale_factor();
|
||||
|
||||
let x_direction = if position.x < border_size {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue