Merge pull request #8376 from electron/revert-8354-vibrancy-corner-fix
Revert "Smooth corners for vibrancy view"
This commit is contained in:
commit
caacc4580f
1 changed files with 0 additions and 30 deletions
|
@ -347,12 +347,10 @@ bool ScopedDisableResize::disable_resize_ = false;
|
||||||
@property NSPoint windowButtonsOffset;
|
@property NSPoint windowButtonsOffset;
|
||||||
@property (nonatomic, retain) AtomPreviewItem* quickLookItem;
|
@property (nonatomic, retain) AtomPreviewItem* quickLookItem;
|
||||||
@property (nonatomic, retain) NSView* vibrantView;
|
@property (nonatomic, retain) NSView* vibrantView;
|
||||||
@property (nonatomic, retain) NSImage* cornerMask;
|
|
||||||
|
|
||||||
- (void)setShell:(atom::NativeWindowMac*)shell;
|
- (void)setShell:(atom::NativeWindowMac*)shell;
|
||||||
- (void)setEnableLargerThanScreen:(bool)enable;
|
- (void)setEnableLargerThanScreen:(bool)enable;
|
||||||
- (void)enableWindowButtonsOffset;
|
- (void)enableWindowButtonsOffset;
|
||||||
- (NSImage*)_cornerMask;
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation AtomNSWindow
|
@implementation AtomNSWindow
|
||||||
|
@ -506,12 +504,6 @@ bool ScopedDisableResize::disable_resize_ = false;
|
||||||
return [[self contentView] superview];
|
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
|
// Quicklook methods
|
||||||
|
|
||||||
- (BOOL)acceptsPreviewPanelControl:(QLPreviewPanel*)panel {
|
- (BOOL)acceptsPreviewPanelControl:(QLPreviewPanel*)panel {
|
||||||
|
@ -1291,28 +1283,6 @@ void NativeWindowMac::SetVibrancy(const std::string& type) {
|
||||||
[effect_view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
|
[effect_view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
|
||||||
[effect_view setBlendingMode:NSVisualEffectBlendingModeBehindWindow];
|
[effect_view setBlendingMode:NSVisualEffectBlendingModeBehindWindow];
|
||||||
[effect_view setState:NSVisualEffectStateActive];
|
[effect_view setState:NSVisualEffectStateActive];
|
||||||
|
|
||||||
// The default corner radius of a macOS window.
|
|
||||||
CGFloat radius = 5.0f;
|
|
||||||
CGFloat dimension = 2 * radius + 1;
|
|
||||||
NSSize size = NSMakeSize(dimension, dimension);
|
|
||||||
NSImage* maskImage = [[NSImage imageWithSize:size
|
|
||||||
flipped:NO
|
|
||||||
drawingHandler:^BOOL(NSRect rect) {
|
|
||||||
NSBezierPath* bezierPath = [NSBezierPath
|
|
||||||
bezierPathWithRoundedRect:rect
|
|
||||||
xRadius:radius
|
|
||||||
yRadius:radius];
|
|
||||||
[[NSColor blackColor] set];
|
|
||||||
[bezierPath fill];
|
|
||||||
return YES;
|
|
||||||
}] autorelease];
|
|
||||||
[maskImage setCapInsets:NSEdgeInsetsMake(radius, radius, radius, radius)];
|
|
||||||
[maskImage setResizingMode:NSImageResizingModeStretch];
|
|
||||||
|
|
||||||
[effect_view setMaskImage:maskImage];
|
|
||||||
[window_ setCornerMask:maskImage];
|
|
||||||
|
|
||||||
[[window_ contentView] addSubview:effect_view
|
[[window_ contentView] addSubview:effect_view
|
||||||
positioned:NSWindowBelow
|
positioned:NSWindowBelow
|
||||||
relativeTo:nil];
|
relativeTo:nil];
|
||||||
|
|
Loading…
Reference in a new issue