Repository navigation
Windows: the custom titlebar's caption buttons, window menu and frame behave as native ones do - #172
Merged
Merged
Conversation
… behave as native ones do
Alt+Space opens the window menu (posted SC_KEYMENU) when no handler takes it and never types a space. Caption presses are one CaptionState (Idle, Hovered, Pressed { button, over }) with mouse capture, so dragging off cancels, dragging back resumes and no release leaves a button stuck. The buttons sit in a frame of Rune's own and stay in reach of UI Automation while the view holds a modal. Non-resizable windows dim maximize with no snap layouts; WM_DPICHANGED resizes once; maximizing fits the destination display; edge drags draw each size at once; Windows 10 keeps its top border. Cx::titlebar_height sizes the band and the caption buttons with the app's zoom, memos rebuild when Cx::chrome_insets changes, the playground and hot reload keep the window's chrome, and TitlebarAction is back to Drag and DoubleClick.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
This was referenced Nov 23, 2026
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.
Follow-up to #134: the custom titlebar's caption buttons, window menu and frame now behave as native ones do on Windows.
SC_KEYMENU, so its modal loop runs from the message loop) only when no handler takes the key, never types a space into a focused field, and ignores Ctrl+Alt+Space.CaptionState(Idle | Hovered | Pressed { button, over }) with mouse capture. Dragging off cancels, dragging back resumes, no other button lights up meanwhile, and no release (top edge, outside the window, lost capture) leaves a button stuck.rune-frame) that no root border, clip or transform moves, and they stay in the UI Automation tree and invokable while the view holds a modal.HTMAXBUTTONand no snap layouts. A window with neither box shows only Close.WM_DPICHANGEDresizes once (winit's own move lands on Windows' rect). Maximizing uses the destination monitor (MonitorFromRect) and checks the auto-hide bar withIsWindow. Edge drags draw each size at once. Windows 10 keeps a 1 px top border.WM_ERASEBKGNDreturns 1.Cx::titlebar_height(h)sizes the band and the caption buttons as the app runs, so they line up with the app's row at every UI zoom.Cx::chrome_insetschanges. Staged playground stories no longer get the window's insets or caption colour, and the side column clears the buttons.App::titlebarandCx::caption_color.TitlebarActionis back toDragandDoubleClick; the window menu is a crate-private latch.sync_chromeno longer returns a value, andHost::try_createmoved towindow/create.rs.Checks:
cargo check --workspace --all-targets,cargo check -p rune --lib --target wasm32-unknown-unknown, and--target aarch64-apple-darwin/x86_64-unknown-linux-gnu(lib) all pass, as do the targeted existing tests (titlebar pointer_hit modal window_wake chrome caption alt, 43 passed). Live proof usedcargo run -p rune --example custom_titlebar, driven with posted messages and UI Automation.Before (#134):
After, press Close, drag onto Maximize, back onto Close, release off it, release on the top edge:
After, Alt+Space in the focused field ("ab", no space typed):
After, modal open (the caption buttons stay in UIA, and invoking Maximize works):
After,
Cx::titlebar_heightat zoom 1.0, 1.25 and 0.8:After, no
WS_MAXIMIZEBOX: