feat(ui): #1280 App({ windowState }) — start maximized / fullscreen - #1283
Merged
Conversation
Adds a `windowState?: "normal" | "maximized" | "fullscreen"` option to the
`App({...})` config so apps can launch already maximized or fullscreen
without the user having to hit the green button / F11. Original request
from discussion #1232 was for Windows; implemented cross-platform.
- codegen: `perry-codegen` lowers the new prop to a
`perry_ui_app_set_window_state(handle, str_ptr)` call between
`set_icon` and `set_body` so each backend can record the state and
apply it at `app_run` time.
- Windows: `SW_SHOWMAXIMIZED` for maximized; for fullscreen strip
`WS_OVERLAPPEDWINDOW` and resize to the full monitor rect via
`MonitorFromWindow` + `GetMonitorInfoW`.
- macOS: `NSWindow.zoom:` for maximized; `toggleFullScreen:` for
fullscreen (falls back to zoom if the window isn't resizable, since
AppKit silently no-ops fullscreen on non-resizable windows).
- GTK4: `gtk_window_maximize` / `gtk_window_fullscreen`, applied just
before `present()` so the window appears already in the target state.
- iOS / tvOS / visionOS / watchOS / Android: no-op stubs — full-screen
windowing isn't a desktop concept on those platforms.
- types: `windowState` added to the `App(config)` signature in
`types/perry/ui/index.d.ts`.
Verified locally on macOS via `PERRY_UI_TEST_MODE=1` screenshots —
"maximized" fills the screen with the title bar visible; "fullscreen"
removes the title bar and covers the entire monitor.
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
windowState?: "normal" | "maximized" | "fullscreen"to theApp({...})config so an app can launch already maximized or fullscreen instead of at its requestedwidth/height.SW_SHOWMAXIMIZED/ monitor-rect fullscreen, AppKitNSWindow.zoom:/toggleFullScreen:, GTK4maximize()/fullscreen(). iOS / tvOS / visionOS / watchOS / Android get no-op stubs.Codegen
The
App({...})LLVM lowering incrates/perry-codegen/src/lower_call/native/mod.rsalready special-casestitle/width/height/body/icon; this PR adds awindowStatearm that lowers the string to an i64 pointer and emitsperry_ui_app_set_window_state(handle, str_ptr)betweenset_iconandset_body. Each backend records the state in its per-app entry and applies it atapp_runtime, because both Win32 (ShowWindow(SW_SHOWMAXIMIZED)) and AppKit (zoom:/toggleFullScreen:) need the window to already exist + be visible before the state transition takes effect.Verification
Tested locally on macOS by compiling a
windowState: "maximized"smoke and awindowState: "fullscreen"smoke withPERRY_UI_TEST_MODE=1 PERRY_UI_SCREENSHOT_PATH=.... Both produced screenshots covering the full display; the maximized variant kept the title bar visible, and the fullscreen variant removed it.Cross-platform paths verified by symbol/syntax review only — perry-ui-windows can't link on macOS (webview2-com-sys is Win-only) and perry-ui-gtk4 needs webkitgtk-6.0 which isn't installed here.
Test plan
App({ windowState: "maximized", ... })on Windows and confirm the window opens already maximized.windowState: "fullscreen"on Windows (borderless full-monitor) and macOS (native fullscreen Space).