Skip to content

Fix: lay out the arranged subviews of an NSStackView with constraints - #892

Open
DTW-Thalion wants to merge 6 commits into
gnustep:masterfrom
DTW-Thalion:feature/stackview-constraint-layout
Open

Fix: lay out the arranged subviews of an NSStackView with constraints#892
DTW-Thalion wants to merge 6 commits into
gnustep:masterfrom
DTW-Thalion:feature/stackview-constraint-layout

Conversation

@DTW-Thalion

@DTW-Thalion DTW-Thalion commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

This needs #643, which carries the constraint solver; a commit there fixes the engine bookkeeping this exercises. Without #643 the arranged views are not laid out at all and the new test set skips.

-_layoutViewsWithOrientation: took the spacing as the stride, so three views at spacing 10 landed at 0, 10 and 20 on top of each other. It read neither the distribution nor the alignment, and it grew the stack view's own frame on every pass.

-updateConstraints now builds the layout: the first view against the leading edge plus the inset, each later one against the trailing edge of the view before it plus the gap, and every view against the alignment attribute on the cross axis. Fill gives the spare room to the first view, FillEqually shares it out but keeps any view wider than the equal share, FillProportionally scales the extents by one factor, EqualSpacing equalises the gaps, and EqualCentering equalises the distance between centres. Each of them leaves the extents alone where the views do not fit and runs past the trailing edge.

The frames in Tests/gui/NSStackView/arrangedLayout.m were measured on macOS 26. No assertion in that file passes before the change and all 17 pass after; Tests/gui/NSStackView is 46 passed 0 failed under a display.

Closes #628

@DTW-Thalion
DTW-Thalion requested a review from fredkiefer as a code owner August 5, 2026 19:42
@DTW-Thalion
DTW-Thalion force-pushed the feature/stackview-constraint-layout branch from e711a97 to 2872850 Compare August 5, 2026 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

NSStackView arranged-subview handling and layout diverge from AppKit

2 participants