codebytere

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

Merged
Created: Apr 20, 2026, 7:16:02 AM
Merged: Apr 21, 2026, 12:32:30 PM
3 comments
Target: main

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).

Backports

41-x-y
Merged
PR Number
#51217
Merged At
Apr 22, 2026, 5:33:06 AM
Released In
v41.3.0
Release Date
Apr 22, 2026, 4:04:18 PM
42-x-y
Merged
PR Number
#51218
Merged At
Apr 21, 2026, 4:42:19 PM
Released In
v42.0.0-beta.7
Release Date
Apr 29, 2026, 3:06:55 PM

Semver Impact

Major
Breaking changes
Minor
New features
Patch
Bug fixes
None
Docs, tests, etc.

Semantic Versioning helps users understand the impact of updates:

  • Major (X.y.z): Breaking changes that may require code modifications
  • Minor (x.Y.z): New features that maintain backward compatibility
  • Patch (x.y.Z): Bug fixes that don't change the API
  • None: Changes that don't affect using facing parts of Electron