electron/shell/browser/ui/cocoa/electron_ns_window.h
trop[bot] 9a2b4f84be
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>
2025-09-27 10:30:52 -07:00

53 lines
1.6 KiB
Objective-C

// Copyright (c) 2018 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ELECTRON_SHELL_BROWSER_UI_COCOA_ELECTRON_NS_WINDOW_H_
#define ELECTRON_SHELL_BROWSER_UI_COCOA_ELECTRON_NS_WINDOW_H_
#include "base/memory/raw_ptr.h"
#include "components/remote_cocoa/app_shim/native_widget_mac_nswindow.h"
#include "shell/browser/ui/cocoa/event_dispatching_window.h"
#include "ui/views/widget/native_widget_mac.h"
namespace electron {
class NativeWindowMac;
// Prevents window from resizing during the scope.
class ScopedDisableResize {
public:
ScopedDisableResize() { disable_resize_++; }
~ScopedDisableResize() { disable_resize_--; }
// True if there are 1+ nested ScopedDisableResize objects in the scope
static bool IsResizeDisabled() { return disable_resize_ > 0; }
private:
static int disable_resize_;
};
} // namespace electron
class ElectronNativeWindowObserver;
@interface ElectronNSWindow : NativeWidgetMacNSWindow {
@private
raw_ptr<electron::NativeWindowMac> shell_;
}
@property BOOL acceptsFirstMouse;
@property BOOL enableLargerThanScreen;
@property BOOL disableAutoHideCursor;
@property BOOL disableKeyOrMainWindow;
@property(nonatomic, retain) NSVisualEffectView* vibrantView;
- (id)initWithShell:(electron::NativeWindowMac*)shell
styleMask:(NSUInteger)styleMask;
- (void)cleanup;
- (electron::NativeWindowMac*)shell;
- (id)accessibilityFocusedUIElement;
- (NSRect)originalContentRectForFrameRect:(NSRect)frameRect;
- (BOOL)toggleFullScreenMode:(id)sender;
- (void)disableHeadlessMode;
@end
#endif // ELECTRON_SHELL_BROWSER_UI_COCOA_ELECTRON_NS_WINDOW_H_