Skip to content

fix: MacOS 26 Tahoe - stop overriding private cornerMask API to fix WindowServer GPU load - #48376

Merged
VerteDinde merged 2 commits into
electron:mainfrom
avarayr:macos-remove-corner-mask
Sep 26, 2025
Merged

VerteDinde merged 2 commits into
electron:mainfrom
avarayr:macos-remove-corner-mask

Conversation

@avarayr

@avarayr avarayr commented Sep 25, 2025 •

Copy link
Copy Markdown
Contributor

Description of Change

fixes: #48311

  • stop overriding the private _cornerMask selector in ElectronNSWindow
  • remove the cornerMask plumbing that applied a custom mask image to vibrant views
  • rely on AppKit’s default shadow rendering, which fixes the WindowServer GPU spike on macOS 26 Tahoe when shadows are enabled

Rationale:

If AppKit uses method implementation identity to decide whether the window mask is static, then a subclass override (even if it calls super) will change that identity and force the compositor to treat the mask as dynamic.

Method-IMP sentinel check

AppKit asks: “is _cornerMask implemented by the standard theme frame?” via class_getMethodImplementation / method_getImplementation.
If yes → treat masks as canonical and use a shared cache keyed by class/selector;
if no → mark mask as custom and re-render per-window. → persistent high GPU load

Backwards-compat concerns:

I see no reason to override _cornerMask as the corner radius masking is already covered by NSVisualEffectView setMaskImage, rendering NO visual difference without _cornerMask override + vibrancy

Checklist

Release Notes

Notes: Fixed excessive WindowServer GPU usage on macOS Tahoe 26.

@welcome

welcome Bot commented Sep 25, 2025

Copy link
Copy Markdown

💖 Thanks for opening this pull request! 💖

Semantic PR titles

We use semantic commit messages to streamline the release process. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix.

Examples of commit messages with semantic prefixes:

  • fix: don't overwrite prevent_default if default wasn't prevented
  • feat: add app.isPackaged() method
  • docs: app.isDefaultProtocolClient is now available on Linux

Commit signing

This repo enforces commit signatures for all incoming PRs.
To sign your commits, see GitHub's documentation on Telling Git about your signing key.

PR tips

Things that will help get your PR across the finish line:

  • Follow the JavaScript, C++, and Python coding style.
  • Run npm run lint locally to catch formatting errors earlier.
  • Document any user-facing changes you've made following the documentation styleguide.
  • Include tests when adding/changing behavior.
  • Include screenshots and animated GIFs whenever possible.

We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can.

@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Sep 25, 2025
… GPU load spike

Electron fetched a custom `_cornerMask` for `ElectronNSWindow` to smooth
vibrancy corners. On macOS 15 (Tahoe) that private hook forces the window
shadow to be rendered from a fully transparent surface, causing the
WindowServer GPU load regression. Remove the `cornerMask` property and
the `_cornerMask` override so we stay on Apple’s default shadow path.
@deepak1556 deepak1556 added semver/patch backwards-compatible bug fixes target/37-x-y PR should also be added to the "37-x-y" branch. target/38-x-y PR should also be added to the "38-x-y" branch. target/39-x-y PR should also be added to the "39-x-y" branch. labels Sep 25, 2025
@jkleinsc

Copy link
Copy Markdown
Member

@avarayr can you rebase your PR to pull in the latest from main. That will pull in #48205 which will fix the CI failures.

@MarshallOfSound

Copy link
Copy Markdown
Member

Tested this and validated the bug from N years ago is no longer present in modern macOS versions (frameless vibrant windows not being rounded)

@VerteDinde VerteDinde 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.

@avarayr Thanks so much for all of your time and effort digging into this issue - I'm sorry for the trouble, the Electron maintainers really appreciate you doing such a deep dive on this fairly complex issue and putting up this fix 🙇‍♀️

@nikwen

nikwen commented Sep 26, 2025

Copy link
Copy Markdown
Member

Thank you, @avarayr and @fredizzimo, for debugging this and finding a solution!

@VerteDinde
VerteDinde merged commit 3a7c6dd into electron:main Sep 26, 2025
@welcome

welcome Bot commented Sep 26, 2025

Copy link
Copy Markdown

Congrats on merging your first pull request! 🎉🎉🎉

@release-clerk

release-clerk Bot commented Sep 26, 2025

Copy link
Copy Markdown

Release Notes Persisted

Fixed excessive WindowServer GPU usage on macOS Tahoe 26.

trop Bot added a commit that referenced this pull request Sep 26, 2025
…indowServer GPU load (#48376)

fix: macOS stop overriding private cornerMask API to fix WindowServer GPU load spike

Electron fetched a custom `_cornerMask` for `ElectronNSWindow` to smooth
vibrancy corners. On macOS 15 (Tahoe) that private hook forces the window
shadow to be rendered from a fully transparent surface, causing the
WindowServer GPU load regression. Remove the `cornerMask` property and
the `_cornerMask` override so we stay on Apple’s default shadow path.

Co-authored-by: avarayr <7735415+avarayr@users.noreply.github.com>
trop Bot added a commit that referenced this pull request Sep 26, 2025
…indowServer GPU load (#48376)

fix: macOS stop overriding private cornerMask API to fix WindowServer GPU load spike

Electron fetched a custom `_cornerMask` for `ElectronNSWindow` to smooth
vibrancy corners. On macOS 15 (Tahoe) that private hook forces the window
shadow to be rendered from a fully transparent surface, causing the
WindowServer GPU load regression. Remove the `cornerMask` property and
the `_cornerMask` override so we stay on Apple’s default shadow path.

Co-authored-by: avarayr <7735415+avarayr@users.noreply.github.com>
trop Bot added a commit that referenced this pull request Sep 26, 2025
…indowServer GPU load (#48376)

fix: macOS stop overriding private cornerMask API to fix WindowServer GPU load spike

Electron fetched a custom `_cornerMask` for `ElectronNSWindow` to smooth
vibrancy corners. On macOS 15 (Tahoe) that private hook forces the window
shadow to be rendered from a fully transparent surface, causing the
WindowServer GPU load regression. Remove the `cornerMask` property and
the `_cornerMask` override so we stay on Apple’s default shadow path.

Co-authored-by: avarayr <7735415+avarayr@users.noreply.github.com>
@trop

trop Bot commented Sep 26, 2025

Copy link
Copy Markdown
Contributor

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

@trop trop Bot added in-flight/38-x-y and removed target/38-x-y PR should also be added to the "38-x-y" branch. labels Sep 26, 2025
TheCommieAxolotl pushed a commit to TheCommieAxolotl/electron that referenced this pull request Nov 2, 2025
…indowServer GPU load (electron#48376)

fix: macOS stop overriding private cornerMask API to fix WindowServer GPU load spike

Electron fetched a custom `_cornerMask` for `ElectronNSWindow` to smooth
vibrancy corners. On macOS 15 (Tahoe) that private hook forces the window
shadow to be rendered from a fully transparent surface, causing the
WindowServer GPU load regression. Remove the `cornerMask` property and
the `_cornerMask` override so we stay on Apple’s default shadow path.
max-horvath added a commit to max-horvath/hyper that referenced this pull request Nov 13, 2025
Upgrades Electron from 34.5.1 to 38.6.0 to resolve excessive WindowServer
GPU usage on macOS 26 (Sequoia). This issue was caused by Electron's
override of the private _cornerMask API, which forced the compositor to
treat window masks as dynamic rather than static, resulting in persistent
high GPU load.

Changes:
- Upgrade electron: 34.5.1 → 38.6.0
- Upgrade electron-mksnapshot: 34.5.1 → 38.6.0
- Upgrade @electron/rebuild: ^3.7.1 → ^3.7.2
- Upgrade node-abi: ^3.67.0 → ^3.81.0 (required for Electron 38 support)

The fix was introduced in Electron 36.9.2, 37.6.0, 38.2.0, and all later
versions. We're upgrading to 38.6.0 as it's the latest stable version
compatible with Node 20.11.0.

Fixes: electron/electron#48376
nilayarya pushed a commit to nilayarya/electron that referenced this pull request Nov 21, 2025
…indowServer GPU load (electron#48376)

fix: macOS stop overriding private cornerMask API to fix WindowServer GPU load spike

Electron fetched a custom `_cornerMask` for `ElectronNSWindow` to smooth
vibrancy corners. On macOS 15 (Tahoe) that private hook forces the window
shadow to be rendered from a fully transparent surface, causing the
WindowServer GPU load regression. Remove the `cornerMask` property and
the `_cornerMask` override so we stay on Apple’s default shadow path.
nilayarya added a commit to nilayarya/electron that referenced this pull request Nov 21, 2025
…indowServer GPU load (electron#48376)

fix: macOS stop overriding private cornerMask API to fix WindowServer GPU load spike

Electron fetched a custom `_cornerMask` for `ElectronNSWindow` to smooth
vibrancy corners. On macOS 15 (Tahoe) that private hook forces the window
shadow to be rendered from a fully transparent surface, causing the
WindowServer GPU load regression. Remove the `cornerMask` property and
the `_cornerMask` override so we stay on Apple’s default shadow path.
nilayarya added a commit to nilayarya/electron that referenced this pull request Nov 21, 2025
…indowServer GPU load (electron#48376)

fix: macOS stop overriding private cornerMask API to fix WindowServer GPU load spike

Electron fetched a custom `_cornerMask` for `ElectronNSWindow` to smooth
vibrancy corners. On macOS 15 (Tahoe) that private hook forces the window
shadow to be rendered from a fully transparent surface, causing the
WindowServer GPU load regression. Remove the `cornerMask` property and
the `_cornerMask` override so we stay on Apple’s default shadow path.
philip-peterson added a commit to quine-global/hyper that referenced this pull request Jan 4, 2026
* Fix macOS 26 GPU performance issue by upgrading to Electron 38

Upgrades Electron from 34.5.1 to 38.6.0 to resolve excessive WindowServer
GPU usage on macOS 26 (Sequoia). This issue was caused by Electron's
override of the private _cornerMask API, which forced the compositor to
treat window masks as dynamic rather than static, resulting in persistent
high GPU load.

Changes:
- Upgrade electron: 34.5.1 → 38.6.0
- Upgrade electron-mksnapshot: 34.5.1 → 38.6.0
- Upgrade @electron/rebuild: ^3.7.1 → ^3.7.2
- Upgrade node-abi: ^3.67.0 → ^3.81.0 (required for Electron 38 support)

The fix was introduced in Electron 36.9.2, 37.6.0, 38.2.0, and all later
versions. We're upgrading to 38.6.0 as it's the latest stable version
compatible with Node 20.11.0.

Fixes: electron/electron#48376

* Use optional chaining

Signed-off-by: Philip Peterson <1326208+philip-peterson@users.noreply.github.com>

---------

Signed-off-by: Philip Peterson <1326208+philip-peterson@users.noreply.github.com>
Co-authored-by: Philip Peterson <1326208+philip-peterson@users.noreply.github.com>
lefarcen pushed a commit to nexu-io/nexu that referenced this pull request Mar 29, 2026
Nexu 0.1.7 (Electron 37.10.3) fails to launch on macOS 26.1 Tahoe —
process spawns but immediately exits with status 0, no window appears
(#649). Electron 37.x has multiple known macOS 26 issues:

- Launch crash / EXC_BREAKPOINT during ElectronMain init (electron/electron#49522)
- WindowServer GPU perf regression from private _cornerMask API override
  (electron/electron#48311, fixed in electron/electron#48376)

Upgrades from ^37.2.5 to ^38.2.0 (resolves to 38.8.6), which includes
all macOS Tahoe fixes.

Breaking changes from 37→38 are all benign for this macOS-focused app:
- macOS 11 (Big Sur) dropped (we target recent macOS)
- Wayland/GTK changes (Linux only, not relevant)
- isAeroGlassEnabled removed (Windows only, unused)

Closes #649

https://claude.ai/code/session_014T4ZxuSuZriSHC65C15dsi
tisfeng pushed a commit to tisfeng/Easydict that referenced this pull request May 1, 2026
…GPU pegging

On macOS 26 Tahoe, AppKit decides whether to share the window corner-mask
cache via a method-identity check. Any NSWindow subclass that directly
overrides the private `_cornerMask` selector is treated as custom, which
disables the cache and forces WindowServer to re-render every frame —
showing up as sustained 60–100% WindowServer CPU and global UI lag.

Easydict's own window subclasses don't override `_cornerMask`, but several
private system/SwiftUI subclasses loaded in-process do (verified via
runtime scan): `_NSTextFinderOverlayWindow`, `SwiftUISuggestionsWindow`,
`QLBubbleWindow`, `QLPreviewPanel`, `IKPictureTaker`.

Walk the runtime class list once at startup (before SwiftUI creates any
window), find every NSWindow subclass that directly defines
`_cornerMask`, and reset its IMP to NSWindow's default. This restores the
shared cache path and matches the upstream Electron fix in
electron/electron#48376.

Refs: electron/electron#48311
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged/36-x-y PR was merged to the "36-x-y" branch. merged/37-x-y PR was merged to the "37-x-y" branch. merged/38-x-y PR was merged to the "38-x-y" branch. merged/39-x-y PR was merged to the "39-x-y" branch. semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Electron-based apps cause a huge system-wide lag on macOS 26

10 participants