Just round the top also and use a standard window.
Using borderless window causes too many issues. Smaller, less window-like shadows being the most annoying.
This commit is contained in:
parent
aabba3c641
commit
cf4a566290
1 changed files with 10 additions and 29 deletions
|
@ -78,7 +78,7 @@
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
static CGFloat const AtomWindowCornerRadius = 5.0;
|
static CGFloat const AtomWindowCornerRadius = 4.0;
|
||||||
|
|
||||||
@interface AtomNSWindow : AtomEventProcessingWindow {
|
@interface AtomNSWindow : AtomEventProcessingWindow {
|
||||||
@protected
|
@protected
|
||||||
|
@ -104,21 +104,6 @@ static CGFloat const AtomWindowCornerRadius = 5.0;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface AtomFramelessView : NSView
|
|
||||||
@end
|
|
||||||
|
|
||||||
@implementation AtomFramelessView
|
|
||||||
- (void)drawRect:(NSRect) rect {
|
|
||||||
NSBezierPath * shadowPath = [NSBezierPath bezierPathWithRoundedRect:NSInsetRect([self bounds], 0.5, 0.5)
|
|
||||||
xRadius:AtomWindowCornerRadius
|
|
||||||
yRadius:AtomWindowCornerRadius];
|
|
||||||
|
|
||||||
[[NSColor blackColor] set];
|
|
||||||
[shadowPath fill];
|
|
||||||
[shadowPath addClip];
|
|
||||||
}
|
|
||||||
@end
|
|
||||||
|
|
||||||
@interface AtomFramelessNSWindow : AtomNSWindow
|
@interface AtomFramelessNSWindow : AtomNSWindow
|
||||||
- (void)drawCustomFrameRect:(NSRect)rect forView:(NSView*)view;
|
- (void)drawCustomFrameRect:(NSRect)rect forView:(NSView*)view;
|
||||||
@end
|
@end
|
||||||
|
@ -135,6 +120,10 @@ static CGFloat const AtomWindowCornerRadius = 5.0;
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL)canBecomeMainWindow {
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
- (BOOL)hasShadow {
|
- (BOOL)hasShadow {
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
@ -197,8 +186,8 @@ NativeWindowMac::NativeWindowMac(content::WebContents* web_contents,
|
||||||
|
|
||||||
NSRect main_screen_rect = [[[NSScreen screens] objectAtIndex:0] frame];
|
NSRect main_screen_rect = [[[NSScreen screens] objectAtIndex:0] frame];
|
||||||
NSRect cocoa_bounds = NSMakeRect(
|
NSRect cocoa_bounds = NSMakeRect(
|
||||||
(NSWidth(main_screen_rect) - width) / 2,
|
round((NSWidth(main_screen_rect) - width) / 2) ,
|
||||||
(NSHeight(main_screen_rect) - height) / 2,
|
round((NSHeight(main_screen_rect) - height) / 2),
|
||||||
width,
|
width,
|
||||||
height);
|
height);
|
||||||
|
|
||||||
|
@ -215,7 +204,7 @@ NativeWindowMac::NativeWindowMac(content::WebContents* web_contents,
|
||||||
} else {
|
} else {
|
||||||
atomWindow = [[AtomFramelessNSWindow alloc]
|
atomWindow = [[AtomFramelessNSWindow alloc]
|
||||||
initWithContentRect:cocoa_bounds
|
initWithContentRect:cocoa_bounds
|
||||||
styleMask:NSBorderlessWindowMask | NSClosableWindowMask |
|
styleMask:NSTitledWindowMask | NSClosableWindowMask |
|
||||||
NSMiniaturizableWindowMask | NSResizableWindowMask
|
NSMiniaturizableWindowMask | NSResizableWindowMask
|
||||||
backing:NSBackingStoreBuffered
|
backing:NSBackingStoreBuffered
|
||||||
defer:YES];
|
defer:YES];
|
||||||
|
@ -503,19 +492,11 @@ void NativeWindowMac::InstallView() {
|
||||||
} else {
|
} else {
|
||||||
NSView* frameView = [[window() contentView] superview];
|
NSView* frameView = [[window() contentView] superview];
|
||||||
|
|
||||||
AtomFramelessView * shadowView = [[AtomFramelessView alloc] initWithFrame: [frameView bounds]];
|
[view setFrame:[frameView bounds]];
|
||||||
[shadowView setAutoresizesSubviews:YES];
|
[frameView addSubview:view];
|
||||||
[shadowView setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
|
|
||||||
|
|
||||||
[view setFrame:[shadowView bounds]];
|
|
||||||
[frameView addSubview:shadowView];
|
|
||||||
[shadowView addSubview:view];
|
|
||||||
|
|
||||||
|
|
||||||
ClipWebView();
|
ClipWebView();
|
||||||
//
|
|
||||||
// [window() setHasShadow: NO];
|
|
||||||
// [window() setHasShadow: YES];
|
|
||||||
|
|
||||||
[[window() standardWindowButton:NSWindowZoomButton] setHidden:YES];
|
[[window() standardWindowButton:NSWindowZoomButton] setHidden:YES];
|
||||||
[[window() standardWindowButton:NSWindowMiniaturizeButton] setHidden:YES];
|
[[window() standardWindowButton:NSWindowMiniaturizeButton] setHidden:YES];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue