Repository navigation
feat(desktop): open windows maximized and set the state explicitly - #2822
Merged
Merged
Conversation
Add WindowOptions.Maximized and nsgo.WindowMaximized, which macOS, Windows and Linux apply before the window first shows, and desktop.SetMaximized, which asks for a state instead of toggling it. The core seeds a new surface's environment from the state it asked for, so desktop.Maximized is valid from the first frame. Fixes #2816
houko
added a commit
to nsgo-dev/game
that referenced
this pull request
Dec 1, 2026
Moves the game layer, the tools module and the sample games from NSGo v0.4.0 to NSGo main at 8e5c1cc (v0.4.1-0.20261201013927-8e5c1cc14ee7), so a project that requires NSGo main, such as for nsgo.WindowMaximized (nsgo-dev/nsgo#2822), can build the game layer. NSGo's only breaking change since v0.4.0 (nsgo-dev/nsgo#2739) makes core.Style.FlexShrink a core.FlexShrink and shrinks growing boxes, scroll views along their scroll axis and the auto-sized boxes around them by default. Every numeric factor keeps its value: FlexShrink: 1 becomes core.Shrink(1) and FlexShrink: 0 becomes core.NoShrink (906 sites in pkg/editor, pkg/scene, pkg/online/admin/console, internal, the templates and their embedded copies, and the examples), and the docs and the nsgo-game skill show the new form. The operator console's embedded web build is regenerated for the new sources and NSGo version. go mod tidy also adds the indirect requirements the examples were missing for nsgo's cmd/nsgo tool (quic-go and friends) and lists modelcontextprotocol/go-sdk as a direct requirement of the tools module, which imports it. BREAKING CHANGE: the game layer requires an NSGo newer than v0.4.0, whose core.Style.FlexShrink is a core.FlexShrink.
houko
added a commit
to nsgo-dev/orbit-academy-game
that referenced
this pull request
Dec 1, 2026
…ayer main Move to nsgo main (8e5c1cc), which opens the main window maximized from its first frame (nsgo-dev/nsgo#2822) and brings the environment refresh (nsgo-dev/nsgo#2821) and sprite-frame crop cache (nsgo-dev/nsgo#2817) fixes, and to the game layer main (be78552), which builds against it (nsgo-dev/game#2723). Replace maximizeOnce, which waited for the first window frame to toggle maximize, with nsgo.WindowMaximized in main.go, and migrate the one numeric FlexShrink to core.Shrink.
houko
added a commit
to nsgo-dev/orbit-academy-game
that referenced
this pull request
Dec 1, 2026
…ayer main (#5) Move to nsgo main (8e5c1cc), which opens the main window maximized from its first frame (nsgo-dev/nsgo#2822) and brings the environment refresh (nsgo-dev/nsgo#2821) and sprite-frame crop cache (nsgo-dev/nsgo#2817) fixes, and to the game layer main (be78552), which builds against it (nsgo-dev/game#2723). Replace maximizeOnce, which waited for the first window frame to toggle maximize, with nsgo.WindowMaximized in main.go, and migrate the one numeric FlexShrink to core.Shrink.
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.
Summary
Fixes #2816.
desktop.WindowOptions.Maximized(andnsgo.WindowMaximized()for the main window) opens a window maximized, zoomed on macOS, before it first shows, so it never appears at its size first.NoMaximize/NoResizeconstraints leave it at its size.desktop.SetMaximized(cx, on)asks for a state instead of toggling it (driver.WindowSetMaximized). Called before the window first shows, such as from content as it mounts, it opens the window in that state rather than showing it and then resizing.openSurfaceseeds the new surface's environment from the state it asked for, sodesktop.Maximizedreads true from the first frame of a window opened maximized instead of false until the platform's first report.desktop.Maximizednow documents when it is valid.Per platform:
zoom:(whatToggleMaximizesends) after centering and before the window attaches, so AppKit keeps the centered frame to zoom back to and the first layout and environment have the zoomed frame.SetMaximizedzooms only whenisZoomeddiffers.SW_SHOWMAXIMIZEDinstead ofSW_SHOW/SW_SHOWNA(first batch,Show,OrderFront, owned-window sync), and reportsMaximizedmeanwhile.SetMaximizedon a window that has not shown yet changes how it will show instead of showing it, which avoids the deferred-show cancel the issue describes.gtk_window_maximizebefore GTK maps the window, which GTK applies as it maps it. A test host's window, normally fixed in size for tiling compositors, stays resizable when opened maximized so the window manager maximizes it.nsgotestrecordsWindowSetMaximizedandSurfaceConfig.Maximized.Targets
core,base,ui,tsx, thensgotool)Screenshots
None
Verification
41de904f77eec6a55d369ade1b75fb69f64be1e9fd02adf8ed86177303d3db4d5a3ee119690c8175go tool nsgo check -target macos,windows,linux,ios→ 0go tool nsgo test ./core ./nsgotest ./desktop ./internal/driver ./internal/backend ./internal/testhost/testdata/windowstate→ 0TestWindowOpensMaximizedininternal/testhost/testdata/windowstateskipped headless (it needs a GUI session); this PR adds it to the macOS and Windows window-state CI steps, and the Linux step already runs that whole package under openbox. The new Windows logic testTestFirstShowMaximizesOnceonly runs in the Windows CI job.Test output (host run, macOS arm64 over SSH):
Checklist
fix(linux): keep the caret after a paste; a squash merge uses it as the commit subject.changelog.d/fragment, not inCHANGELOG.md.