Repository navigation
Center the close glyph and size Close like the other caption buttons - #5644
Merged
Merged
Conversation
The Close caption button was widened by the window frame inset and given matching right padding. Its hover fill is the full button bounds, so on a restored window it was wider than Minimize and Maximize, and the X was centered over only the leftmost 46 px, landing off-center in the visible button. The extra width was never needed for hit-testing: the side and corner resize edges are returned before the caption buttons, which keeps the outer band resizing. Remove the per-state inset adjustment so Close is a fixed 46x44 button like its siblings, flush with the right edge, with the glyph centered by the caption style's zero padding. The outermost frame-width pixels of Close still resize rather than close, as they did after the previous change. Fixes #5637 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
The caption-button fix lacks live Windows verification of alignment, glyph centering, and edge-resize behavior in restored and maximized states at 100% and higher DPI.
No open issues 🎉
What changed in this PR
Fixes the restored-window Close button’s unequal width and off-center glyph by removing its dynamic inset adjustment. This addresses #5637 while preserving right-edge alignment and resize hit-testing.
Changes:
- Keeps Close at the same fixed 46×44 size as the other caption buttons.
- Removes the inset calculation and its startup/window-state callbacks.
- Removes the unused Close button name from XAML.
| File | Description |
|---|---|
src/UniGetUI.Avalonia/Views/MainWindow.axaml.cs |
Removes dynamic Close button sizing and simplifies the window-state callback. |
src/UniGetUI.Avalonia/Views/MainWindow.axaml |
Removes the unused button name while retaining fixed dimensions and caption styling. |
Review effort: Balanced
There was a problem hiding this comment.
🤖 Pull request was approved automatically: the AI review is complete and all its review threads are resolved. 🎉
Integration Details
{
"deliveryId": "630813b0-d472-11f1-854c-87c99f39ebcf",
"headSha": "d0a0667acc767feeed88cb46d4e508a932ab7201",
"reviewer": "copilot-pull-request-reviewer[bot]"
}
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.
Root cause
The custom Windows caption strip is right-aligned in a client area that covers the whole window: the WM_NCCALCSIZE hook returns 0, so the WS_THICKFRAME band (about 8 px at 100%, more at higher DPI) is visible client area. #5477 added
MainWindow.UpdateCaptionButtonInset, which measured that band and pushed the strip left by it. #5590 kept the measurement but setCaptionCloseButton.Width = 46 + insetandPadding = (0,0,inset,0). The Close button's background is the full Button bounds, so on a restored window its gray and red hover fill became wider than Minimize and Maximize, and the right padding centred the X over the left 46 px only, leaving it off-centre in the visible button. Maximized, the inset is 0, which is why it only shows on a restored window.The extra width was never needed for hit-testing: #5477 also made WM_NCHITTEST return the side and corner resize edges (
HitTestResizeBorder) before testing the caption buttons, and that ordering keeps the outer band resizing.Fix
Removed the per-state inset adjustment. Close is now the same fixed 46x44 button as Minimize and Maximize, flush with the window's right edge, with the X centred by the caption style's
Padding=0. DeletedUpdateCaptionButtonInset, its two callers (the WM_SHOWWINDOW/WM_SIZE post goes back toDispatcher.UIThread.Post(cornerOwner.UpdateWindowCornerPreference)), and the unusedx:Name="CaptionCloseButton". The hit-test ordering from #5477 is kept. Close reaches the window edge (#5571) and the three buttons are identical with a centred glyph (#5637).Verification
dotnet build src/UniGetUI.Avalonia/UniGetUI.Avalonia.csproj -p:Platform=x64 -p:UseSharedCompilation=falseexited 0 with 0 errors (warnings are unrelated analyzer and obsolete-API ones; not compared against a baseline).dotnet format whitespaceanddotnet format style --verify-no-changeson the changed files exited 0.Regression test
None added. The bug is native window-chrome layout driven by a live Win32 HWND (
IsZoomed,GetDpiForWindow,AdjustWindowRectExForDpiinside the WM_SHOWWINDOW/WM_SIZE hook). No unit test can reach that without a real top-level window, and after the fix no logic is left: the button is a static 46x44 declaration.Review notes (non-blocking)
HitTestResizeBorder, which runs before the caption-button hit test, so they resize instead of closing while the hover fill can still show there. Changing the order would bring back the Skip installers already on disk and make bundle downloads resolve a real version #5469/Let the resize border win over the caption buttons on the side edges #5477 behaviour.caption caption-closein MainWindow.axaml) was never touched by Extend the Close button to the window's right edge #5590 and is left alone.dotnet format style src/UniGetUI.Windows.slnx --no-restore --verify-no-changesexits 2 because of IDE0060 atsrc/UniGetUI.PackageEngine.Tests/CargoManagedOperationRoutingTests.cs:155(unusedcancellationToken). The same command scoped to UniGetUI.Avalonia.csproj exits 0.Closes #5637
🤖 Generated with Claude Code