fix: correct bounds and constraints on Windows for framed and frameless windows#51179
Closed
mitchchn wants to merge 4 commits into
Closed
fix: correct bounds and constraints on Windows for framed and frameless windows#51179mitchchn wants to merge 4 commits into
mitchchn wants to merge 4 commits into
Conversation
Member
Author
|
/request-review @codebytere,@ckerr |
e50ce18 to
52c5efc
Compare
ba41105 to
5334862
Compare
5334862 to
c3ec3d2
Compare
Member
Author
|
Getting some feedback upstream before proceeding with this: https://chromium-review.googlesource.com/c/chromium/src/+/7795073 |
tobias-jarvelov
added a commit
to mullvad/mullvadvpn-app
that referenced
this pull request
May 18, 2026
The window is 16px less in width and 8px less in height than the what we have set as the window bounds, Likely related to the following issue: electron/electron#50783 See also: electron/electron#51179 electron/electron#50706
tobias-jarvelov
added a commit
to mullvad/mullvadvpn-app
that referenced
this pull request
May 18, 2026
The window is 16px less in width and 8px less in height than the what we have set as the window bounds, Likely related to the following issue: electron/electron#50783 See also: electron/electron#51179 electron/electron#50706
tobias-jarvelov
added a commit
to mullvad/mullvadvpn-app
that referenced
this pull request
May 21, 2026
The window is 16px less in width and 8px less in height than the what we have set as the window bounds, Likely related to the following issue: electron/electron#50783 See also: electron/electron#51179 electron/electron#50706
tobias-jarvelov
added a commit
to mullvad/mullvadvpn-app
that referenced
this pull request
Jun 4, 2026
The window is 16px less in width and 8px less in height than the what we have set as the window bounds, Likely related to the following issue: electron/electron#50783 See also: electron/electron#51179 electron/electron#50706
tobias-jarvelov
added a commit
to mullvad/mullvadvpn-app
that referenced
this pull request
Jun 4, 2026
The window is 16px less in width and 8px less in height than the what we have set as the window bounds, Likely related to the following issue: electron/electron#50783 See also: electron/electron#51179 electron/electron#50706
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.
Description of Change
Fixes #50783.
This PR regularizes bounds and constraints handling on Windows so that windows are created at their exact expected sizes and can grow and shrink to exact max/min constraints. Previously sizes be off by 8-16px because insets weren't always accounted for on creation or after various lifecycle events.
Bound/inset logic is fragile and hard to reason about, so I added about a dozen cross-platform constraint tests which run for both framed and frameless windows to help prevent regressions.
As was the case on Linux, the underlying issues originate in Chromium, which does not experience them as severely since it usually only enforces minimum sizes and it rarely changes bounds or constraints programmatically. The solution requires two Chromium patches:
DesktopWindowTreeHostWin::AdjustedContentBounds.(This patch needs to use lower level DWM code since it does not have access to the frame.)
I was able to upstream the relevant patches when working on this problem for Linux, and I'll also attempt to upstream both of my changes as well as the previous work from @CezaryKulakowski.
Checklist
npm testpassesRelease Notes
Notes: Fixed an issue on Windows where windows appeared smaller than their configured size or were unable to be resized to their maximum size constraints.