pub fn window_metrics(
physical: (u32, u32),
scale: f64,
insets: WindowInsets,
) -> WindowMetricsExpand description
Assemble the app-facing WindowMetrics from a shell’s raw surface
dimensions, its already-sanitize_scaled scale, and the window’s
already-logical WindowInsets.
The one place the three shells agree on units. physical is the surface’s
device-pixel size (Android’s nativeOnSurfaceChanged pair, iOS’s
frust_resize pair, winit’s inner_size()), converted to logical px here
through logical_size — so WindowMetrics::size is logical on every
platform, exactly like the coordinates and insets that already cross this
boundary (docs/CODE_STANDARDS.md’s physical-at-FFI/logical-inside rule).
insets is passed through unchanged because each shell has already
resolved it to logical px via logical_insets (Android divides by its
display density, iOS uses the identity scale because UIKit hands over
points) — this must never re-divide it.
WindowMetrics::orientation is derived from the
logical size by WindowMetrics::new; no platform callback carries an
orientation enum.
scale must already have passed through sanitize_scale (finite,
strictly positive) — the same trust contract logical_size and
logical_insets state, so a shell sanitizes the platform density once per
use and feeds the identical value to all three.