fix: MacOS 26 Tahoe - stop overriding private cornerMask API to fix WindowServer 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.
This commit is contained in:
avarayr
2025-09-26 15:41:16 -04:00
committed by GitHub
parent 26e886c517
commit 3a7c6dd4a5
3 changed files with 0 additions and 15 deletions

View File

@@ -1333,7 +1333,6 @@ void NativeWindowMac::UpdateVibrancyRadii(bool fullscreen) {
maskImage.capInsets = NSEdgeInsetsMake(radius, radius, radius, radius);
maskImage.resizingMode = NSImageResizingModeStretch;
[vibrantView setMaskImage:maskImage];
[window_ setCornerMask:maskImage];
}
}
}

View File

@@ -40,7 +40,6 @@ class ElectronNativeWindowObserver;
@property BOOL disableAutoHideCursor;
@property BOOL disableKeyOrMainWindow;
@property(nonatomic, retain) NSVisualEffectView* vibrantView;
@property(nonatomic, retain) NSImage* cornerMask;
- (id)initWithShell:(electron::NativeWindowMac*)shell
styleMask:(NSUInteger)styleMask;
- (void)cleanup;
@@ -48,7 +47,6 @@ class ElectronNativeWindowObserver;
- (id)accessibilityFocusedUIElement;
- (NSRect)originalContentRectForFrameRect:(NSRect)frameRect;
- (BOOL)toggleFullScreenMode:(id)sender;
- (NSImage*)_cornerMask;
- (void)disableHeadlessMode;
@end

View File

@@ -25,7 +25,6 @@ int ScopedDisableResize::disable_resize_ = 0;
} // namespace electron
@interface NSWindow (PrivateAPI)
- (NSImage*)_cornerMask;
- (int64_t)_resizeDirectionForMouseLocation:(CGPoint)location;
@end
@@ -123,7 +122,6 @@ void SwizzleSwipeWithEvent(NSView* view, SEL swiz_selector) {
@synthesize disableAutoHideCursor;
@synthesize disableKeyOrMainWindow;
@synthesize vibrantView;
@synthesize cornerMask;
- (id)initWithShell:(electron::NativeWindowMac*)shell
styleMask:(NSUInteger)styleMask {
@@ -308,16 +306,6 @@ void SwizzleSwipeWithEvent(NSView* view, SEL swiz_selector) {
return [super validateUserInterfaceItem:item];
}
// By overriding this built-in method the corners of the vibrant view (if set)
// will be smooth.
- (NSImage*)_cornerMask {
if (self.vibrantView != nil) {
return [self cornerMask];
} else {
return [super _cornerMask];
}
}
- (void)disableHeadlessMode {
if (shell_) {
// We initialize the window in headless mode to allow painting before it is