Skip to content

Commit 6984f4e

Browse files
authored
Merge pull request #917 from ychin/transparent-titlebar-pre-mojave
Make MMTitlebarAppearsTransparent option work on pre-Mojave
2 parents 588c934 + 0fc97e3 commit 6984f4e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/MacVim/MMWindowController.m

+19
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,26 @@ - (void)setDefaultColorsBackground:(NSColor *)back foreground:(NSColor *)fore
591591
}
592592
}
593593
}
594+
else
594595
#endif
596+
{
597+
// 10.13 or below. As noted above, the window flag
598+
// NSWindowStyleMaskTexturedBackground doesn't play well with window color,
599+
// but if we are toggling the titlebar transparent option, we need to set
600+
// the window background color in order the title bar to be tinted correctly.
601+
if ([[NSUserDefaults standardUserDefaults]
602+
boolForKey:MMTitlebarAppearsTransparentKey]) {
603+
if ([back alphaComponent] != 0) {
604+
[decoratedWindow setBackgroundColor:back];
605+
} else {
606+
// See above HACK for more details. Basically we cannot set a
607+
// color with 0 alpha or the window manager will give it a
608+
// different treatment.
609+
NSColor *clearColor = [back colorWithAlphaComponent:0.001];
610+
[decoratedWindow setBackgroundColor:clearColor];
611+
}
612+
}
613+
}
595614

596615
[vimView setDefaultColorsBackground:back foreground:fore];
597616
}

0 commit comments

Comments
 (0)