Report the content size in the macOS window frame event - #286
Open
sepehr-safari wants to merge 1 commit into
Open
Report the content size in the macOS window frame event#286sepehr-safari wants to merge 1 commit into
sepehr-safari wants to merge 1 commit into
Conversation
The runtime lays its shell views out into the width and height of the window frame it is told about (`shellBoundsForWindow`), and it creates and restores windows through `initWithContentRect:`, so those two numbers are a content size on every other path. The AppKit host reported `window.frame`, which includes the chrome. On a standard titlebar that is 32 points of disagreement. An app whose manifest asks for 760x760 is created with a 760x760 content view, and then told its shell is 760x792, so it lays out 32 points taller than the view it lives in and anything on its bottom edge lands below the window. A status bar disappears completely and comes back the first time the window is resized, because the resize event carries `contentView.bounds` and is correct. The origin stays the frame's, which is what positions the window on screen and what the restore path already round-trips.
|
@sepehr-safari is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
sepehr-safari
added a commit
to zig-nostr/plaza
that referenced
this pull request
Aug 5, 2026
The toolkit reported the window's FRAME where the runtime wanted its CONTENT size, so the canvas was 32 points taller than the view it lived in and the status bar was laid out below the bottom edge. It was invisible on every fresh launch and came back the first time anyone dragged the window, which is why it read as intermittent rather than as always broken. Measured five launches each way. Before: canvas 760x792, status bar at y 761 to 792, entirely outside a 760pt content view. After: canvas 760x760, status bar at y 729 to 760, on the floor of it. The window frame is 760x792 in both, so the window was always the right size; only the number the app was handed changed. The fix is one line in the toolkit's AppKit host and is reported upstream as vercel-labs/native#286. Until that lands the dependency points at a fork carrying exactly that commit on top of the same base this already pinned, so the diff against upstream is one commit and moving back is a one-line change. The acceptance suite now measures it. No unit test can: the layout is correct at whatever size it is handed, and the defect is which size that is, so it only exists in a real window. Closes #100.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug
The runtime lays its shell views out into the width and height of the window
frame it is told about:
Windows are also created and restored through
initWithContentRect:, so on everyother path those two numbers are a content size. The AppKit host reported
window.frame, which includes the chrome.With a standard titlebar that is 32 points of disagreement.
What it looks like from an app
An app whose manifest asks for 760x760 gets a 760x760 content view, and is then
told its shell is 760x792. It lays out 32 points taller than the view it lives
in, so anything on the bottom edge is placed below the window.
Measured on a real app with a status bar on the floor of its canvas, five
launches out of five:
CGWindowListCopyWindowInforeports the window frame as 760x792 in both, so thewindow itself was always the right size. Only the number the app was handed
changed.
It reads as intermittent, which is what made it confusing. The bar is absent from
every launch and then appears permanently the first time the window is resized,
because
emitResizeForWindowIdalready sendscontentView.boundsand iscorrect. Whether anyone sees the bug depends only on whether they happened to
drag the window.
The fix
emitWindowFrameForWindowIdreportscontentRectForFrameRect:for the size. Theorigin stays the frame's, which is what positions the window on screen and what
the restore path already round-trips.
What I tried first, and why it is not this
Making
shellBoundsForWindowuseself.surface.sizeinstead. The surface doescarry the correct content size, but it is not populated until the host sends its
first resize, so at startup it is still the 640x360 default. That fails
which is the suite catching it exactly. The host is the right place: it is the
only layer that knows the chrome height, and every other window path there
already speaks in content rects.
Checks
zig build teston macOS produces the same result with this patch as without it.