Skip to content

fix: external resize hit targets for frameless windows on Windows - #50864

Merged
ckerr merged 1 commit into
42-x-yfrom
trop/42-x-y-bp-fix-external-resize-hit-targets-for-frameless-windows-on-windows-1775776401817
Apr 10, 2026
Merged

ckerr merged 1 commit into
42-x-yfrom
trop/42-x-y-bp-fix-external-resize-hit-targets-for-frameless-windows-on-windows-1775776401817

Conversation

@trop

@trop trop Bot commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

Backport of #50706

See that PR for details.

Notes: Fixed resize hit targets for frameless windows on Windows. Resize targets now start at the side and bottom edges of the window and extend outward when frame: false, matching the behavior for windows with frames.

@trop
trop Bot requested a review from a team April 9, 2026 23:13
@trop trop Bot added 42-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes labels Apr 9, 2026
@ckerr
ckerr force-pushed the trop/42-x-y-bp-fix-external-resize-hit-targets-for-frameless-windows-on-windows-1775776401817 branch from ab6aaca to f1f8ec9 Compare April 10, 2026 13:06
@ckerr
ckerr merged commit 4affacb into 42-x-y Apr 10, 2026
110 of 111 checks passed
@ckerr
ckerr deleted the trop/42-x-y-bp-fix-external-resize-hit-targets-for-frameless-windows-on-windows-1775776401817 branch April 10, 2026 18:18
@release-clerk

release-clerk Bot commented Apr 10, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed resize hit targets for frameless windows on Windows. Resize targets now start at the side and bottom edges of the window and extend outward when frame: false, matching the behavior for windows with frames.

t-bashir-bs added a commit to brightsign/electron that referenced this pull request Jun 2, 2026
…play OS-21449

When creating a frameless BrowserWindow spanning multiple displays
(e.g. 3840x1080 across dual HDMI), CenterWindow in the NativeWindowViews
constructor clamps the size to the primary display's work area (1920x1080).
InitFromOptions then called SetPosition(x, y), which only updated the
position and preserved the clamped size, so the window was permanently
stuck at 1920x1080.

Fix: change InitFromOptions to call SetBounds with the full rect
(position + original size from options) instead of SetPosition, restoring
the intended dimensions after CenterWindow's clamping.

This regression was introduced by upstream Electron commit 4affacb
("fix: external resize hit targets for frameless windows on Windows",
PR electron#50864). That commit added a guard condition
`if (!GetRestoredFrameBorderInsets().IsEmpty())` around a post-CenterWindow
SetBounds call in the NativeWindowViews constructor, which previously
ran unconditionally on Linux. For frameless windows (where frame border
insets are zero), the SetBounds is now skipped, leaving CenterWindow's
clamped size in effect.

In Electron 28, the unconditional SetBounds after CenterWindow always
restored the original requested size:

  // On linux after the widget is initialized we might have to force set the
  // bounds if the bounds are smaller than the current display
  SetBounds(gfx::Rect(GetPosition(), bounds.size()), false);

This was preserved in commit 931c257 (PR electron#49209, "accurate window
sizing and support for content sizing on Linux/Wayland with CSD"), which
even documented the intent: "The widget clamps bounds to fit the screen,
but we want to allow windows larger than the display." The subsequent
commit 4affacb then inadvertently broke this for frameless windows.
t-bashir-bs added a commit to brightsign/electron that referenced this pull request Jun 2, 2026
…play OS-21449 (#141)

When creating a frameless BrowserWindow spanning multiple displays
(e.g. 3840x1080 across dual HDMI), CenterWindow in the NativeWindowViews
constructor clamps the size to the primary display's work area (1920x1080).
InitFromOptions then called SetPosition(x, y), which only updated the
position and preserved the clamped size, so the window was permanently
stuck at 1920x1080.

Fix: change InitFromOptions to call SetBounds with the full rect
(position + original size from options) instead of SetPosition, restoring
the intended dimensions after CenterWindow's clamping.

This regression was introduced by upstream Electron commit 4affacb
("fix: external resize hit targets for frameless windows on Windows",
PR electron#50864). That commit added a guard condition
`if (!GetRestoredFrameBorderInsets().IsEmpty())` around a post-CenterWindow
SetBounds call in the NativeWindowViews constructor, which previously
ran unconditionally on Linux. For frameless windows (where frame border
insets are zero), the SetBounds is now skipped, leaving CenterWindow's
clamped size in effect.

In Electron 28, the unconditional SetBounds after CenterWindow always
restored the original requested size:

  // On linux after the widget is initialized we might have to force set the
  // bounds if the bounds are smaller than the current display
  SetBounds(gfx::Rect(GetPosition(), bounds.size()), false);

This was preserved in commit 931c257 (PR electron#49209, "accurate window
sizing and support for content sizing on Linux/Wayland with CSD"), which
even documented the intent: "The widget clamps bounds to fit the screen,
but we want to allow windows larger than the display." The subsequent
commit 4affacb then inadvertently broke this for frameless windows.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

42-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant