Skip to content

fix: remove 1px line from the top of frameless windows on Linux - #51458

Merged
VerteDinde merged 1 commit into
electron:mainfrom
mitchchn:mitch/transparent-root-view-csd
Jun 15, 2026
Merged

VerteDinde merged 1 commit into
electron:mainfrom
mitchchn:mitch/transparent-root-view-csd

Conversation

@mitchchn

@mitchchn mitchchn commented May 2, 2026 •

Copy link
Copy Markdown
Member

Description of Change

Fixes #51457.

On Linux, CSD frames are responsible for drawing everything outside of their web contents, so all backing views should be transparent unless CSD paints over them.

Electron already set the widget background to transparent for CSD windows, but it needed to apply the same correction to the root view behind web contents. The issue only became visible following #50007 because previous CSD frames happened to draw opaque titlebars or 1px borders that covered the exposed part of the root view.

Fixing this issue is also a prerequisite to support rounded corners on Linux: #51459. I originally included the fix in that PR, but it should be considered and backported separately since it fixes a visual glitch by itself.

Backport to 41.x, 42.x.

Checklist

Release Notes

Notes: Fixed a bug on Linux where a 1px line appeared at the top of frameless windows if the window and web contents had different background colors.

@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label May 2, 2026
@mitchchn

mitchchn commented May 2, 2026

Copy link
Copy Markdown
Member Author

/request-review @ckerr, @aiddya

@electron-issue-triage
electron-issue-triage Bot requested a review from ckerr May 2, 2026 21:01
@ckerr ckerr added semver/patch backwards-compatible bug fixes wayland 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 May 2, 2026
@mitchchn

mitchchn commented May 2, 2026

Copy link
Copy Markdown
Member Author

Backporting will need to be manual because of the Linux frame layout refactor but will be very straightforward.

@mitchchn
mitchchn force-pushed the mitch/transparent-root-view-csd branch from ab687d6 to 1cd83ac Compare May 2, 2026 21:27
@electron-cation electron-cation Bot removed the new-pr 🌱 PR opened recently label May 3, 2026
@aiddya

aiddya commented May 4, 2026

Copy link
Copy Markdown
Contributor

The change itself looks good to me, and as you mentioned, it's necessary to enable rounded corners. However, I'm not sure if this is a true fix for #51457. OpaqueFrameView used to add 1px to the button heights, but this was a leftover from Windows that did not make sense on Linux. On Windows, a 1px border is maintained so that DWM considers the window to be framed and handles things like drop shadows and resize.

Unfortunately, I couldn't reproduce this issue on any Electron version. If the bug is still visible with ElectronFrameViewLinux, I think there's some other place where 1px is being added or removed.

@mitchchn

mitchchn commented May 4, 2026

Copy link
Copy Markdown
Member Author

@aiddya Right, it did occur to me that the root view is taller than it should be by 1px (and has been forever on Linux).

My thinking is it doesn't matter too much in practice because the window bounds and content bounds are still accurate, the root view doesn't show up in APIs, and the transparency change needs to be made anyway. So the question for me is whether it's worth hunting down the discrepancy (or maybe turning it into a followup for internal cleanup).

@aiddya

aiddya commented May 4, 2026 •

Copy link
Copy Markdown
Contributor

That's fair. I guess the true root cause is non-trivial since I could not reproduce the issue at all with mutter.

@github-actions github-actions Bot added the target/43-x-y PR should also be added to the "43-x-y" branch. label May 6, 2026
@mitchchn
mitchchn force-pushed the mitch/transparent-root-view-csd branch from 1cd83ac to f09cbe2 Compare May 8, 2026 14:37
@mitchchn
mitchchn force-pushed the mitch/transparent-root-view-csd branch from f09cbe2 to 72f0271 Compare May 16, 2026 16:23
Comment thread shell/browser/native_window_views.cc Resolved
@mitchchn
mitchchn force-pushed the mitch/transparent-root-view-csd branch from 72f0271 to f78a93b Compare May 30, 2026 20:22
@mitchchn
mitchchn force-pushed the mitch/transparent-root-view-csd branch 2 times, most recently from 1224feb to e1c5d21 Compare June 13, 2026 16:21
…backgroundColor is not set

cache background color since it is no longer set on root view
@mitchchn
mitchchn force-pushed the mitch/transparent-root-view-csd branch from e1c5d21 to bd301d5 Compare June 13, 2026 17:17
@VerteDinde
VerteDinde merged commit e86dff7 into electron:main Jun 15, 2026
71 checks passed
@trop

trop Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

I was unable to backport this PR to "41-x-y" cleanly;
you will need to perform this backport manually.

@trop trop Bot removed the target/41-x-y PR should also be added to the "41-x-y" branch. label Jun 15, 2026
@trop

trop Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

I was unable to backport this PR to "42-x-y" cleanly;
you will need to perform this backport manually.

@trop trop Bot removed the target/42-x-y PR should also be added to the "42-x-y" branch. label Jun 15, 2026
@trop

trop Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

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

@trop trop Bot added in-flight/43-x-y and removed target/43-x-y PR should also be added to the "43-x-y" branch. labels Jun 15, 2026
@release-clerk

release-clerk Bot commented Jun 15, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed a bug on Linux where a 1px line appeared at the top of frameless windows if the window and web contents had different background colors.

@trop

trop Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

@mitchchn has manually backported this PR to "41-x-y", please check out #52004

@trop

trop Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

@mitchchn has manually backported this PR to "42-x-y", please check out #52005

mitchchn added a commit to mitchchn/electron that referenced this pull request Jun 15, 2026
…tron#51458)

fix: remove white line from the top of frameless windows on Linux if backgroundColor is not set

cache background color since it is no longer set on root view
mitchchn added a commit to mitchchn/electron that referenced this pull request Jun 15, 2026
…tron#51458)

fix: remove white line from the top of frameless windows on Linux if backgroundColor is not set

cache background color since it is no longer set on root view
jkleinsc pushed a commit that referenced this pull request Jun 16, 2026
…) (#52004)

fix: remove white line from the top of frameless windows on Linux if backgroundColor is not set

cache background color since it is no longer set on root view
@trop trop Bot added merged/41-x-y PR was merged to the "41-x-y" branch. and removed in-flight/41-x-y labels Jun 16, 2026
VerteDinde pushed a commit that referenced this pull request Jun 16, 2026
…) (#52005)

fix: remove white line from the top of frameless windows on Linux if backgroundColor is not set

cache background color since it is no longer set on root view
@trop trop Bot added merged/42-x-y PR was merged to the "42-x-y" branch. and removed in-flight/42-x-y labels Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

44-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. merged/43-x-y PR was merged to the "43-x-y" branch. semver/patch backwards-compatible bug fixes wayland

Projects

No open projects
Status: No status

Development

Successfully merging this pull request may close these issues.

Frameless window on Wayland has a white line on top

5 participants