Skip to content

fix: preserve transparency across setResizable toggles on Windows - #51175

Merged
jkleinsc merged 1 commit into
mainfrom
fix-min-trans
Apr 21, 2026
Merged

jkleinsc merged 1 commit into
mainfrom
fix-min-trans

Conversation

@codebytere

Copy link
Copy Markdown
Member

Description of Change

Fixes #51094

After #49428 made NativeWindowViews::CanResize() return resizable_ for frameless windows (instead of resizable_ && thick_frame_), HWNDMessageHandler::SizeConstraintsChanged() started adding WS_THICKFRAME to the window style whenever CanResize() reported true. WS_THICKFRAME is incompatible with layered (translucent) windows and destroys their transparency.

SetContentSizeConstraints already guards against this by skipping OnSizeConstraintsChanged() when !thick_frame_. SetResizable did not, so toggling resizability on a transparent window (e.g. setResizable(false) then setResizable(true)) caused the Chromium path to add WS_THICKFRAME and strip transparency.

Apply the same guard in SetResizable. Min/max constraints are still enforced — Chromium reads them from the widget delegate on every WM_GETMINMAXINFO, independent of SizeConstraintsChanged().

Checklist

Release Notes

Notes: Fixed frameless transparent windows on Windows losing their transparency after setResizable(false) followed by setResizable(true).

After #49428 made `NativeWindowViews::CanResize()` return `resizable_`
for frameless windows (instead of `resizable_ && thick_frame_`),
`HWNDMessageHandler::SizeConstraintsChanged()` started adding
`WS_THICKFRAME` to the window style whenever `CanResize()` reported true.
`WS_THICKFRAME` is incompatible with layered (translucent) windows and
destroys their transparency.

`SetContentSizeConstraints` already guards against this by skipping
`OnSizeConstraintsChanged()` when `!thick_frame_`. `SetResizable` did
not, so toggling resizability on a transparent window (e.g.
`setResizable(false)` then `setResizable(true)`) caused the Chromium
path to add `WS_THICKFRAME` and strip transparency.

Apply the same guard in `SetResizable`. Min/max constraints are still
enforced — Chromium reads them from the widget delegate on every
`WM_GETMINMAXINFO`, independent of `SizeConstraintsChanged()`.
@codebytere codebytere added semver/patch backwards-compatible bug fixes target/41-x-y PR should also be added to the "41-x-y" branch. target/42-x-y PR should also be added to the "42-x-y" branch. labels Apr 20, 2026
@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Apr 20, 2026
@codebytere
codebytere requested review from ckerr and mlaurencin April 20, 2026 14:13
@electron-cation electron-cation Bot removed the new-pr 🌱 PR opened recently label Apr 21, 2026
@jkleinsc
jkleinsc merged commit 2ba6d28 into main Apr 21, 2026
98 of 102 checks passed
@jkleinsc
jkleinsc deleted the fix-min-trans branch April 21, 2026 17:32
@release-clerk

release-clerk Bot commented Apr 21, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed frameless transparent windows on Windows losing their transparency after setResizable(false) followed by setResizable(true).

@trop

trop Bot commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "41-x-y", please check out #51217

@trop

trop Bot commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "42-x-y", please check out #51218

@trop trop Bot added in-flight/42-x-y merged/42-x-y PR was merged to the "42-x-y" branch. merged/41-x-y PR was merged to the "41-x-y" branch. and removed target/41-x-y PR should also be added to the "41-x-y" branch. target/42-x-y PR should also be added to the "42-x-y" branch. in-flight/42-x-y in-flight/41-x-y labels Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged/41-x-y PR was merged to the "41-x-y" branch. merged/42-x-y PR was merged to the "42-x-y" branch. semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

setResizable(true) after setResizable(false) on a transparent frameless window removes transparency on Windows

2 participants