Owned native installation¶
On an existing macOS StandaloneWindow, call
set_content_constraints(Some(policy)). The wrapper reads actual content size,
preflights compatibility with the window's original optional aspect ratio,
installs native content minimum/maximum properties, and immediately requests the
resolved extent. Invalid or incompatible proposals return false before any
Rust/native policy or geometry write. Native installation widens the old maximum
before setting the new minimum and final maximum, so a smaller replacement does
not temporarily invert the admitted bounds.
content_constraints() returns the last admitted copied policy. Both installs
and set_size reject synchronous reentry while either operation is in progress.
A resize notification emitted during installation sees the prior admitted
policy; the new value is published only after the native call succeeds. This
prevents an older outer operation from overwriting a nested accepted policy.
The main-thread owner, editor-before-parent borrowing and teardown remain in
force. Once a native operation is admitted, arbitrary foreign Cocoa observer
effects cannot be rolled back by RAVET.
After window close admission, policy installation and
resize reject, content_size() returns None, and the last admitted copied
policy remains readable. Close requests share the synchronous operation guard.
set_size retains its finite 320..=4096 by 240..=4096 request limits. An installed
policy resolves those requests before native fitting. None restores the exact
native user-resize content minimum/maximum captured at creation without making
a new size request. Subsequent programmatic sizing follows the original
no-policy behavior, including requests below the native user-resize minimum.
Native user constraints, programmatic requests and actual measurements are
different observations. Cocoa can independently round dimensions to logical
points: measured content may differ from policy bounds or the compatible aspect
projection by up to one point. Read content_size() after pumping and lay out
the measured viewport; do not treat the requested size as an exact result.
These checks do not establish human drag behavior or another native backend.