add border radius to frameless window (#20360)

This commit is contained in:
Nate Wienert 2020-01-12 22:43:00 -08:00 committed by Cheng Zhao
parent 20c910f98e
commit 425d2a2e1b
3 changed files with 31 additions and 0 deletions

View file

@ -36,12 +36,14 @@ class ScopedDisableResize {
@property BOOL disableAutoHideCursor;
@property BOOL disableKeyOrMainWindow;
@property(nonatomic, retain) NSView* vibrantView;
@property(nonatomic, retain) NSImage* cornerMask;
- (id)initWithShell:(electron::NativeWindowMac*)shell
styleMask:(NSUInteger)styleMask;
- (electron::NativeWindowMac*)shell;
- (id)accessibilityFocusedUIElement;
- (NSRect)originalContentRectForFrameRect:(NSRect)frameRect;
- (void)toggleFullScreenMode:(id)sender;
- (NSImage*)_cornerMask;
@end
#endif // SHELL_BROWSER_UI_COCOA_ATOM_NS_WINDOW_H_

View file

@ -24,6 +24,7 @@ bool ScopedDisableResize::disable_resize_ = false;
@synthesize disableAutoHideCursor;
@synthesize disableKeyOrMainWindow;
@synthesize vibrantView;
@synthesize cornerMask;
- (id)initWithShell:(electron::NativeWindowMac*)shell
styleMask:(NSUInteger)styleMask {
@ -139,6 +140,12 @@ bool ScopedDisableResize::disable_resize_ = false;
return [[self contentView] superview];
}
// By overriding this built-in method the corners of the vibrant view (if set)
// will be smooth.
- (NSImage*)_cornerMask {
return [self cornerMask];
}
// Quicklook methods
- (BOOL)acceptsPreviewPanelControl:(QLPreviewPanel*)panel {