codebytere

#52012: fix: frameless window shrinks on maximize() when compositor declines

Merged
Created: Jun 15, 2026, 7:50:04 PM
Merged: Jun 17, 2026, 9:55:07 AM
8 comments
Target: main

Description of Change

On Wayland, BrowserWindow.maximize() on a frameless / titleBarStyle:hidden / WCO window shrinks the window by ~30x41px each call when the compositor ignores xdg_toplevel.set_maximized (sway floating windows, any tiling WM).

Ozone calls PlatformWindowDelegate::CalculateInsetsInDIP(window_state) twice per configure — once in HandleToplevelConfigureWithOrigin to outset the compositor geometry to widget bounds, and again in SetWindowGeometry to inset back — and assumes both calls return the same value for the same window_state. Our override returns GetRestoredFrameBorderInsets() for kNormal, which reaches FrameViewLayoutLinux::GetShadowValues() and reads widget->IsMaximized(). TriggerStateChanges()' optimistic ForceApplyWindowStateDoNotUse(kMaximized) is live for the first call and reverted by the second, so the insets are ~2x1 then ~32x42 and the geometry round-trip loses 30x41px.

Stop delegating to the base GetShadowValues() and compute the restored shadow values directly, so "restored" insets describe the restored state regardless of current widget state. Painting is unaffected: the maximized and fullscreen paint paths don't consult GetShadowValues(), and GetFrameBorderInsets() has its own IsMaximized() guard.

Also quiets the xdg_toplevel.set_min_size (2,1)<->(1,1) flutter on every maximize() which had the same cause.

Checklist

Release Notes

Notes: Fixes an issue where clicking the maximize button could progressively shrink the window in some Wayland environments.

Backports

41-x-y
Pending
Waiting for a manual backport
42-x-y
In-flight
PR Number
#52045
Waiting to be merged
43-x-y
In-flight
PR Number
#52039
Waiting to be merged

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