Support backgroundColor for window on mac

This commit is contained in:
Gabriel Handford 2016-01-19 15:24:16 -08:00
parent 1b0da44f38
commit 239baa3e9a
5 changed files with 36 additions and 27 deletions

View file

@ -418,7 +418,7 @@ NativeWindowMac::NativeWindowMac(
if (transparent()) {
// Make window has transparent background.
[window_ setOpaque:NO];
[window_ setHasShadow:NO];
// Setting the background color to clear will also hide the shadow.
[window_ setBackgroundColor:[NSColor clearColor]];
}
@ -706,6 +706,12 @@ bool NativeWindowMac::IsKiosk() {
}
void NativeWindowMac::SetBackgroundColor(const std::string& color_name) {
SkColor background_color = NativeWindow::ParseHexColor(color_name);
NSColor *color = [NSColor colorWithCalibratedRed:SkColorGetR(background_color)
green:SkColorGetG(background_color)
blue:SkColorGetB(background_color)
alpha:1.0];
[window_ setBackgroundColor:color];
}
void NativeWindowMac::SetRepresentedFilename(const std::string& filename) {