Skip to content

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

Merged
ckerr merged 1 commit into
electron:mainfrom
mitchchn:mitch/windows-frameless-resize-targets
Apr 9, 2026
Merged

fix: external resize hit targets for frameless windows on Windows#50706
ckerr merged 1 commit into
electron:mainfrom
mitchchn:mitch/windows-frameless-resize-targets

Conversation

@mitchchn

@mitchchn mitchchn commented Apr 6, 2026

Copy link
Copy Markdown
Member

Description of Change

Fixes #40505.

Corrects the placement of resize hit targets for frameless windows on Windows, which are supposed to be outside the window at the sides and bottom, not inset into the web content. This is inspired by the work started by @hotdogee a year ago in #46703. (That PR has a great diagram showing the expected and current behaviour.)

image

This new implementation uses the abstractions we recently added to support CSD and resize insets on Linux (#49209). Windows has the exact same problem as Linux, just to a much lesser degree: frameless windows need to have larger invisible widgets and asymmetric, inflated insets which do not count against their "logical" size.

Electron is now capable of tracking the insets and hit targets without growing or shrinking the frame from the perspective of users or developers, and without adding Windows-specific logic outside of implementations for shared abstractions.

To limit the scope of changes and possible side effects, I've only implemented resize insets for thickframe: true. Non-thick frame and transparent windows will need more work to have inset resize targets with correct bounds, maximization, etc.

Checklist

Release Notes

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.

@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Apr 6, 2026
@mitchchn mitchchn force-pushed the mitch/windows-frameless-resize-targets branch from a5ffffa to 26b8c8f Compare April 6, 2026 03:42
@github-actions

This comment was marked as resolved.

@github-actions github-actions Bot added the needs-signed-commits Currently some or all of the commits in this PR are not signed label Apr 6, 2026
@mitchchn mitchchn force-pushed the mitch/windows-frameless-resize-targets branch from 26b8c8f to 02b7ff0 Compare April 6, 2026 03:56
@nikwen

nikwen commented Apr 6, 2026

Copy link
Copy Markdown
Member

The build fails with this:

2026-04-06T04:08:05.2536553Z build step: cxx "./obj/electron/electron_lib/frameless_view.o"
2026-04-06T04:08:05.2536899Z siso_rule: clang/cxx
2026-04-06T04:08:05.2537096Z stderr:
2026-04-06T04:08:05.2537439Z In file included from ../../electron/shell/browser/ui/views/frameless_view.cc:7:
2026-04-06T04:08:05.2565420Z ##[error]../../electron/shell/browser/native_window_views.h:201:41: error: use of undeclared identifier 'thick_frame_'; did you mean 'has_frame_'?
2026-04-06T04:08:05.2566228Z   201 |   bool has_thick_frame() const { return thick_frame_; }
2026-04-06T04:08:05.2566590Z       |                                         ^~~~~~~~~~~~
2026-04-06T04:08:05.2566918Z       |                                         has_frame_
2026-04-06T04:08:05.2567383Z ../../electron/shell/browser/native_window.h:515:14: note: 'has_frame_' declared here
2026-04-06T04:08:05.2567807Z   515 |   const bool has_frame_;
2026-04-06T04:08:05.2568049Z       |              ^
2026-04-06T04:08:05.2568411Z In file included from ../../electron/shell/browser/ui/views/frameless_view.cc:7:
2026-04-06T04:08:05.2569886Z ##[error]../../electron/shell/browser/native_window_views.h:201:41: error: 'has_frame_' is a private member of 'electron::NativeWindow'
2026-04-06T04:08:05.2570524Z   201 |   bool has_thick_frame() const { return thick_frame_; }
2026-04-06T04:08:05.2570870Z       |                                         ^
2026-04-06T04:08:05.2571284Z ../../electron/shell/browser/native_window.h:515:14: note: declared private here
2026-04-06T04:08:05.2571663Z   515 |   const bool has_frame_;
2026-04-06T04:08:05.2571903Z       |              ^
2026-04-06T04:08:05.2572118Z 2 errors generated.
2026-04-06T04:08:05.2572240Z 

@mitchchn

mitchchn commented Apr 6, 2026

Copy link
Copy Markdown
Member Author

/request-review @ckerr,@codebytere

@mitchchn mitchchn force-pushed the mitch/windows-frameless-resize-targets branch from 77adbf8 to 2d852af Compare April 7, 2026 02:42
@mitchchn mitchchn marked this pull request as draft April 7, 2026 03:17
@mitchchn mitchchn marked this pull request as ready for review April 7, 2026 15:22
@mitchchn mitchchn force-pushed the mitch/windows-frameless-resize-targets branch from d466d6a to c107dc5 Compare April 7, 2026 15:30
@mitchchn mitchchn marked this pull request as draft April 8, 2026 04:14
@mitchchn mitchchn force-pushed the mitch/windows-frameless-resize-targets branch 4 times, most recently from ca99815 to 7ec7a37 Compare April 9, 2026 02:18
@mitchchn mitchchn marked this pull request as ready for review April 9, 2026 02:20
@mitchchn mitchchn force-pushed the mitch/windows-frameless-resize-targets branch from 7ec7a37 to ca4dfcb Compare April 9, 2026 02:22
@mitchchn mitchchn force-pushed the mitch/windows-frameless-resize-targets branch from ca4dfcb to 1132dbf Compare April 9, 2026 02:38

@codebytere codebytere left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested and looks good to me :)

@codebytere codebytere added semver/patch backwards-compatible bug fixes target/40-x-y PR should also be added to the "40-x-y" branch. 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. and removed needs-signed-commits Currently some or all of the commits in this PR are not signed labels Apr 9, 2026
@mitchchn

mitchchn commented Apr 9, 2026

Copy link
Copy Markdown
Member Author

@codebytere I don’t think this will be backportable to 40.x, just 41 and newer.

@ckerr ckerr removed the target/40-x-y PR should also be added to the "40-x-y" branch. label Apr 9, 2026
@ckerr ckerr merged commit 4203d76 into electron:main Apr 9, 2026
126 of 128 checks passed
@release-clerk

release-clerk Bot commented Apr 9, 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.

@trop

trop Bot commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

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

@trop trop Bot added the in-flight/41-x-y label Apr 9, 2026
@trop

trop Bot commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

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

@trop trop Bot added in-flight/42-x-y 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. 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/41-x-y in-flight/42-x-y labels Apr 9, 2026
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
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. new-pr 🌱 PR opened recently semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Frameless window can't be resized while cursor is next to but outside of window

4 participants