Repository navigation
Windows: App::titlebar draws the app's own titlebar with Rune caption buttons, snap layouts and the window menu - #134
Merged
Merged
Conversation
… buttons, snap layouts and the window menu Titlebar::new(height) is plain data for every platform. On Windows the native title bar goes (WM_NCCALCSIZE keeps the side and bottom resize borders; WM_NCHITTEST answers the top resize band and HTMINBUTTON/HTMAXBUTTON/HTCLOSE over the caption buttons, so Windows 11 shows its snap layouts flyout), and Rune draws the caption buttons as elements over the view, as Electron's titleBarOverlay paints them. macOS maps it to a full-size content view with drag regions and centred traffic lights. Cx::chrome_insets reports what the controls take, Cx::caption_color themes the symbols and Tx::toggle_maximized maximizes or restores. Alt+Space and a right-click on a drag region open the window menu.
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 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.
Windows apps can now draw their own titlebar the way OpenCode's Electron app does. Until now Rune kept the native title bar, so rune-desktop showed two of them.
App::titlebar(Titlebar::new(height))andWindowSpec::titlebar.Cx::chrome_insets()returnsleading,trailingandheight.Cx::caption_colorsets the symbol colour, andTx::toggle_maximizedmaximizes or restores the window.HTMAXBUTTON) stay, as do double-click to maximize, Alt+Space, right-click for the window menu, and the window animations. Rune draws the caption buttons as elements that match Electron'stitleBarOverlay: 46 pt wide, hover and press washes, and a red close button. They are UIA buttons named Minimize, Maximize or Restore, and Close.WM_SYSCHAR, so this frame passes it on.crates/rune/examples/custom_titlebar.rs.Before (native title bar plus the app's own strip):
After:
Maximized:
Caption states (rest, close pressed, light theme, maximize pressed):
Window menu (Alt+Space):
Live checks (Windows 11, 150% scale): I checked the non-client hit codes for the top, corners, sides, bottom and each caption button. I clicked minimize, maximize, restore and close, and pressed one button then released over another (no action). I double-clicked the band to maximize, invoked Maximize and Restore through UIA, and opened the window menu with Alt+Space and with a right-click on a drag region. Maximized, the client area equals the work area.
Not verified: the session was locked during testing, so I could not drive real-mouse drag, snap or the flyout. A macOS build is also unverified, because the C build scripts don't cross-compile here.
Checks:
cargo check --workspace --all-targetsand thewasm32runecheck pass with no new warnings.