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

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.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: avarayr <7735415+avarayr@users.noreply.github.com>
This commit is contained in:
trop[bot] 2025-09-27 10:30:52 -07:00 committed by GitHub
commit 9a2b4f84be
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 0 additions and 15 deletions

View file

@ -1354,7 +1354,6 @@ void NativeWindowMac::UpdateVibrancyRadii(bool fullscreen) {
[maskImage setCapInsets:NSEdgeInsetsMake(radius, radius, radius, radius)]; [maskImage setCapInsets:NSEdgeInsetsMake(radius, radius, radius, radius)];
[maskImage setResizingMode:NSImageResizingModeStretch]; [maskImage setResizingMode:NSImageResizingModeStretch];
[vibrantView setMaskImage:maskImage]; [vibrantView setMaskImage:maskImage];
[window_ setCornerMask:maskImage];
} }
} }
} }

View file

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

View file

@ -25,7 +25,6 @@ int ScopedDisableResize::disable_resize_ = 0;
} // namespace electron } // namespace electron
@interface NSWindow (PrivateAPI) @interface NSWindow (PrivateAPI)
- (NSImage*)_cornerMask;
- (int64_t)_resizeDirectionForMouseLocation:(CGPoint)location; - (int64_t)_resizeDirectionForMouseLocation:(CGPoint)location;
@end @end
@ -123,7 +122,6 @@ void SwizzleSwipeWithEvent(NSView* view, SEL swiz_selector) {
@synthesize disableAutoHideCursor; @synthesize disableAutoHideCursor;
@synthesize disableKeyOrMainWindow; @synthesize disableKeyOrMainWindow;
@synthesize vibrantView; @synthesize vibrantView;
@synthesize cornerMask;
- (id)initWithShell:(electron::NativeWindowMac*)shell - (id)initWithShell:(electron::NativeWindowMac*)shell
styleMask:(NSUInteger)styleMask { styleMask:(NSUInteger)styleMask {
@ -308,16 +306,6 @@ void SwizzleSwipeWithEvent(NSView* view, SEL swiz_selector) {
return [super validateUserInterfaceItem:item]; 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 { - (void)disableHeadlessMode {
if (shell_) { if (shell_) {
// We initialize the window in headless mode to allow painting before it is // We initialize the window in headless mode to allow painting before it is