Skip to content

fix(Win32): propagate expansion through navigation wrappers; DPI-scale navigation header - #11

Open
vitalyster wants to merge 7 commits into
codelynx:developfrom
vitalyster:propagation-fix
Open

fix(Win32): propagate expansion through navigation wrappers; DPI-scale navigation header#11
vitalyster wants to merge 7 commits into
codelynx:developfrom
vitalyster:propagation-fix

Conversation

@vitalyster

@vitalystervitalyster commented Aug 20, 2026

Copy link
Copy Markdown

Two Win32 fixes for navigation containers:

  1. Propagate expansion through navigation wrappers. NavigationSplitView and NavigationStack wrapped their content in containers that dropped the content's expansion flags, so a root view containing a Spacer or ScrollView rendered centered at its natural size instead of filling the window (visible in ParityNavigation). Both wrappers now forward shouldExpandWidth/Height from their children (the split view's sidebar/content/detail columns, the stack's root content) to their container, matching the propagation the stack and overlay wrappers already perform.

  2. DPI-scale navigation header and back button. The 32px header, 60x24 back button and 16px title were fixed 96-DPI sizes, so the whole header bar came out half-size on 200% displays. Header, back button and title now scale by the window's DPI, and the back button width is measured from its text + padding instead of a fixed 60px.

BeforeAfter
navigation_beforenavigation_after

Stacked on #10; Win32 fix stack: #8 (dpi_fixes) → #9 (sf_symbol_map) → #10 (win32-test-fix) → #11.

vitalysterand others added 7 commits August 20, 2026 13:18
The glyph font is scaled by the monitor DPI (pointSize × dpiScale) but
the STATIC box holding it was not, so icons were cropped on high-DPI
displays. Scale the box too.
Co-Authored-By: Claude <noreply@anthropic.com>
SwiftUI window sizes are logical points; windows were created at the
same number of physical pixels, so a 1100×720 window appeared as
550×360 at 200% DPI. Sizes the app specifies (defaultWindowSize,
windowSizing(.size), min/max track sizes) are now scaled by the
window's own DPI (per-monitor).
Windows without a specified size keep the CW_USEDEFAULT system default
instead of the previous hardcoded 400×300/500×600 fallbacks.
Text rendered at DPI-scaled font sizes while the boxes around it were
measured at 96 DPI, so at 200% DPI buttons came out half-size and
cropped.
- measureText scales the default 14pt by the window's DPI (DirectWrite
format and GDI fallback)
- the D2D flat button paints with the scaled default size
- the D2D render target pins its DPI to 96 so drawing coordinates match
the layout engine's physical pixels (the default system-DPI target
reinterpreted every coordinate as DIPs and doubled sizes at 200%)
Adds SF Symbol → Material Symbol mappings: iphone.gen3 → smartphone,
iphone.slash → no_sim, square.on.square → history, camera →
photo_camera, record.circle → fiber_manual_record, plus the matching
PUA codepoints.
The Menu control rework removed the .elements accessor the Menu
command-dispatch test relied on, breaking the Win32 test target
compile. Build the elements via MenuBuilder instead; the test's
purpose — environment capture at render time — is unchanged.
NavigationSplitView and NavigationStack wrapped their content in
containers that dropped the content's expansion flags, so a root view
containing a Spacer or ScrollView rendered centered at its natural size
instead of filling the window (visible in ParityNavigation).
Both wrappers now forward shouldExpandWidth/Height from their children
(the split view's sidebar/content/detail columns, the stack's root
content) to their container, matching the propagation the stack and
overlay wrappers already perform.
The 32px header, 60x24 back button and 16px title were fixed 96-DPI
sizes, so the whole header bar came out half-size on 200% displays.
Header, back button and title now scale by the window's DPI, and the
back button width is measured from its text + padding instead of a
fixed 60px.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@vitalyster