Repository navigation
fix: don't realign a window that is within a point of filling its zone - #1853
Merged
rxhanson merged 1 commit intoSep 12, 2026
Merged
Conversation
macOS shortens an AX size change that grows a window onto the Dock edge by a point, so a Maximize with the Dock on the right comes back 1pt narrow. ClampedWindowAligner read that as a clamped window and centered it, moving the 1pt gap off the Dock edge (where it was invisible) to the opposite edge (where it is not) and leaving the window at x=1. Skip realignment per axis when the shortfall is within a point. Genuine clamps, such as a window holding a fixed aspect ratio, are unaffected. Fixes rxhanson#1852
Owner
|
Thanks for the prompt fix! |
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.
Fixes #1852.
Problem
With the Dock on the right, Maximize leaves the window 1pt narrower than the screen and shifted 1pt right (x=1 instead of x=0). From the log in the issue, on a 1679pt-wide visible frame:
Two things combine, as diagnosed by @nyg in the issue:
ClampedWindowAlignerreads that 1pt shortfall as a clamped window. Maximize shares both left and right screen edges, so the window gets centered:round((1679 - 1678) / 2) = 1.The net effect is that the 1pt gap moves off the Dock edge, where it was invisible, onto the opposite edge, where it is not.
Fix
Skip realignment on an axis when the shortfall there is within a point. I took the first of the two options suggested in the issue — the alternative, applying the size to the left of the target and then moving the window, would change
AccessibilityElement.setFramebehavior for every action to address a 1pt cosmetic issue.The check is per axis, so a window that is a point narrow but genuinely short still gets aligned vertically. Real clamps — a window holding a fixed aspect ratio, for example — are unaffected, since those miss the zone by far more than a point.
Tests
Five cases added to
ClampedWindowAlignerTests, using the measurements from the issue:testMaximizeOnePointNarrowStaysPut— the reported case (zone 1679 wide, window 1678, all four edges shared)testRightHalfOnePointNarrowStaysPut— the right-half variant from the issue's measurement tabletestOnePointShortHeightStaysPut— same tolerance on the vertical axistestOnePointNarrowLeavesOtherAxisAlignmentIntact— a point narrow and genuinely short: width is left alone, height still centerstestShortfallJustOverToleranceStillAligns— pins the boundary so the tolerance can't be widened later without a test failingThe first four fail on
mainand pass with this change. The boundary test passes both ways by design. Full suite: 338 tests, 0 failures.