Skip to content

Commit 0fc97e3

Browse files
committed
Make MMTitlebarAppearsTransparent option work on pre-Mojave
Added the special path to make tranparent titlebars work on pre-Mojave builds as well. It's annoying we have to two maintain separate code paths for how windows / titlebars work but this wasn't too hard to add. We just need to make sure to to set the background color on the window *only* when we have transparent titlebar set. Otherwise we don't want to do it because of weird interactions with textured window flag. This addresses comments made in #888.
1 parent 588c934 commit 0fc97e3

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)