diff --git a/CHANGELOG.md b/CHANGELOG.md index d197b3f..8c3ff26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `PendingApp::on_startup` accepts a callback that will be invoked once the event loop is executing. +- `WindowBehavior::moved` is called when the window moves. ### Changed diff --git a/src/window.rs b/src/window.rs index c7c0ae5..d3488aa 100644 --- a/src/window.rs +++ b/src/window.rs @@ -581,7 +581,10 @@ where } } WindowEvent::Moved(position) => { - self.position = position; + if self.position != position { + self.position = position; + behavior.moved(self); + } } WindowEvent::Destroyed => { return HandleMessageResult::Destroyed; @@ -979,6 +982,11 @@ where #[allow(unused_variables)] fn resized(&mut self, window: &mut RunningWindow) {} + /// The window has been moved. [`RunningWindow::position()`] returns the + /// current position. + #[allow(unused_variables)] + fn moved(&mut self, window: &mut RunningWindow) {} + /// The window's theme has been updated. [`RunningWindow::theme()`] /// returns the current theme. #[allow(unused_variables)]