From 7d2d0dae63ba14142cb5355f10cfff074659ae27 Mon Sep 17 00:00:00 2001 From: Jonathan Johnson Date: Sat, 7 Sep 2024 09:25:35 -0700 Subject: [PATCH] Supporting inner and outer positions --- CHANGELOG.md | 4 ++++ Cargo.lock | 2 +- src/app.rs | 18 ++++++++++++------ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 28157f914..adf9d2e13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 passing it as a parameter for opening additional windows. This new type exposes additional winit information including monitor configurations. - `Window::ocluded` has had its spelling fixed and is now `Window::occluded`. +- `Window::position` has been renamed to `Window::outer_position` +- `Window::set_position` has been renamed to `Window::set_outer_position`. ### Fixed @@ -31,6 +33,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `WindowBehavior::moved` is invoked when the window is repositioned. - `Window::outer_size` is a new function that returns the window's size including decorations. +- `Window::inner_position` returns the position of the top-left of the content + area of the window. ## v0.10.0 (2024-08-20) diff --git a/Cargo.lock b/Cargo.lock index cec222294..48588ea02 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -106,7 +106,7 @@ checksum = "10f00e1f6e58a40e807377c75c6a7f97bf9044fab57816f2414e6f5f4499d7b8" [[package]] name = "appit" version = "0.3.2" -source = "git+https://github.com/khonsulabs/appit#35e011dc9299d037539b7e48b1f61be5c07d528c" +source = "git+https://github.com/khonsulabs/appit#6c59e6942fdeecf8405f0b0ee1098aeb4bef9e60" dependencies = [ "winit", ] diff --git a/src/app.rs b/src/app.rs index 7fafed28a..9695623f0 100644 --- a/src/app.rs +++ b/src/app.rs @@ -274,15 +274,21 @@ where self.window.close(); } - /// Returns the current position of the window. + /// Returns the current inner position of the window. #[must_use] - pub fn position(&self) -> Point { - self.window.position().into() + pub fn inner_position(&self) -> Point { + self.window.inner_position().into() + } + + /// Returns the current outer position of the window. + #[must_use] + pub fn outer_position(&self) -> Point { + self.window.outer_position().into() } - /// Sets the current position of the window. - pub fn set_position(&self, position: Point) { - self.window.set_position(position.into()); + /// Sets the current outer position of the window. + pub fn set_outer_position(&self, position: Point) { + self.window.set_outer_position(position.into()); } /// Returns the current DPI scale of the window.