Thanks Chris, Mike and Syntec.
I’ve implemented all of these additions for the next release:
https://feedback.objo.dev/feature/1353
https://feedback.objo.dev/feature/1354
Window now has two completion events:
Moved fires after the window position has remained stable for 250 milliseconds.
Resized fires after the window size has remained stable for 250 milliseconds.
The existing Resize event remains continuous, so it can still be used for live layout work.
Regarding performance, Avalonia already receives the native position and size notifications. Objo coalesces those notifications before entering the VM, using a lazily created, reusable timer only when a corresponding Objo event handler exists. A window without Moved or Resized handlers does not create the timer or queue completion callbacks. I also optimised the continuous Resize path so it no longer queues VM callbacks when the window has no Resize handler.
A pause of at least 250 milliseconds during a longer drag can produce a completion event for that burst. Resizing from the top or left may produce both Moved and Resized, because the window’s position and size have both changed.
Following Syntec’s suggestion, I’ve also added these methods:
Maximise() puts the window into its maximised state.
Minimise() puts the window into its minimised state.
Restore() returns the window to its normal state.
These are one-shot native state changes and introduce no continuing VM overhead. Maximisable and Minimisable control whether the user can perform those actions through the platform’s window controls; they do not prevent application code from calling the new methods.
The existing SetFullScreen() and ExitFullScreen() methods remain available. Restore() can also return a full-screen window to its normal state.