Skip to content

Commit ec02e85

Browse files
authored
Merge pull request #1268 from ychin/fix-10.9-transparent-titlebar-crash
Fix crashing on 10.9
2 parents 8572495 + 1adb42b commit ec02e85

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

src/MacVim/MMCoreTextView.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,12 @@ - (void)setNeedsDisplayFromRow:(int)row column:(int)col toRow:(int)row2
734734
- (void)drawRect:(NSRect)rect
735735
{
736736
NSGraphicsContext *context = [NSGraphicsContext currentContext];
737+
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_10
737738
CGContextRef ctx = context.CGContext;
739+
#else
740+
CGContextRef ctx = [context graphicsPort];
741+
#endif
742+
738743
[context setShouldAntialias:antialias];
739744
{
740745
CGColorSpaceRef colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);

src/MacVim/MMFullScreenWindow.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ - (NSEdgeInsets) viewOffset {
382382

383383
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_VERSION_12_0)
384384
// Account for newer MacBook Pro's which have a notch, which can be queried using the safe area API.
385-
if ([NSScreen instancesRespondToSelector:@selector(safeAreaInsets)]) {
385+
if (@available(macos 12.0, *)) {
386386
const int safeAreaBehavior = [[NSUserDefaults standardUserDefaults]
387387
integerForKey:MMNonNativeFullScreenSafeAreaBehaviorKey];
388388

src/MacVim/MMWindowController.m

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -571,8 +571,12 @@ - (void)refreshApperanceMode
571571
// has selected as a preference.
572572

573573
// Transparent title bar setting
574-
decoratedWindow.titlebarAppearsTransparent = [[NSUserDefaults standardUserDefaults]
575-
boolForKey:MMTitlebarAppearsTransparentKey];
574+
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_10
575+
if (@available(macos 10.10, *)) {
576+
decoratedWindow.titlebarAppearsTransparent = [[NSUserDefaults standardUserDefaults]
577+
boolForKey:MMTitlebarAppearsTransparentKey];
578+
}
579+
#endif
576580

577581
// No title bar setting
578582
if ([[NSUserDefaults standardUserDefaults]

0 commit comments

Comments
 (0)