diff --git a/src/MacVim/DBPrefsWindowController.m b/src/MacVim/DBPrefsWindowController.m index ac9bf5ced7..27486e58b3 100644 --- a/src/MacVim/DBPrefsWindowController.m +++ b/src/MacVim/DBPrefsWindowController.m @@ -75,8 +75,8 @@ static DBPrefsWindowController *_sharedPrefsWindowController = nil; // If the developer attached a window to this controller // in Interface Builder, it gets replaced with this one. NSPanel *window = [[[NSPanel alloc] initWithContentRect:NSMakeRect(0,0,1000,1000) - styleMask:(NSTitledWindowMask | - NSClosableWindowMask) + styleMask:(NSWindowStyleMaskTitled | + NSWindowStyleMaskClosable) backing:NSBackingStoreBuffered defer:YES] autorelease]; [window setHidesOnDeactivate:NO]; diff --git a/src/MacVim/MMAppController.m b/src/MacVim/MMAppController.m index cb2eb593db..cea068f81b 100644 --- a/src/MacVim/MMAppController.m +++ b/src/MacVim/MMAppController.m @@ -518,7 +518,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef, if (modifiedBuffers) { NSAlert *alert = [[NSAlert alloc] init]; - [alert setAlertStyle:NSWarningAlertStyle]; + [alert setAlertStyle:NSAlertStyleWarning]; [alert addButtonWithTitle:NSLocalizedString(@"Quit", @"Dialog button")]; [alert addButtonWithTitle:NSLocalizedString(@"Cancel", @@ -548,7 +548,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef, if (numWindows > 1 || numTabs > 1) { NSAlert *alert = [[NSAlert alloc] init]; - [alert setAlertStyle:NSWarningAlertStyle]; + [alert setAlertStyle:NSAlertStyleWarning]; [alert addButtonWithTitle:NSLocalizedString(@"Quit", @"Dialog button")]; [alert addButtonWithTitle:NSLocalizedString(@"Cancel", @@ -1582,7 +1582,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef, } [alert setInformativeText:text]; - [alert setAlertStyle:NSWarningAlertStyle]; + [alert setAlertStyle:NSAlertStyleWarning]; [alert runModal]; [alert release]; @@ -1751,7 +1751,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef, @"Unknown URL Scheme dialog, text"), [url host]]]; - [alert setAlertStyle:NSWarningAlertStyle]; + [alert setAlertStyle:NSAlertStyleWarning]; [alert runModal]; [alert release]; } diff --git a/src/MacVim/MMBackend.m b/src/MacVim/MMBackend.m index 4f98541a8e..91fef64ffe 100644 --- a/src/MacVim/MMBackend.m +++ b/src/MacVim/MMBackend.m @@ -3179,7 +3179,7 @@ static int eventModifierFlagsToVimModMask(int modifierFlags) modMask |= MOD_MASK_CTRL; if (modifierFlags & NSAlternateKeyMask) modMask |= MOD_MASK_ALT; - if (modifierFlags & NSCommandKeyMask) + if (modifierFlags & NSEventModifierFlagCommand) modMask |= MOD_MASK_CMD; return modMask; diff --git a/src/MacVim/MMTextViewHelper.m b/src/MacVim/MMTextViewHelper.m index d93fecc07e..fc5adf3108 100644 --- a/src/MacVim/MMTextViewHelper.m +++ b/src/MacVim/MMTextViewHelper.m @@ -163,7 +163,7 @@ KeyboardInputSourcesEqual(TISInputSourceRef a, TISInputSourceRef b) ASLogDebug(@"MACMETA key, don't interpret it"); string = unmod; } else if (imState && (flags & NSControlKeyMask) - && !(flags & (NSAlternateKeyMask|NSCommandKeyMask)) + && !(flags & (NSAlternateKeyMask|NSEventModifierFlagCommand)) && [unmod length] == 1 && ([unmod characterAtIndex:0] == '6' || [unmod characterAtIndex:0] == '^')) { @@ -180,7 +180,7 @@ KeyboardInputSourcesEqual(TISInputSourceRef a, TISInputSourceRef b) [textView interpretKeyEvents:[NSArray arrayWithObject:event]]; if (interpretKeyEventsSwallowedKey) string = nil; - else if (flags & NSCommandKeyMask) { + else if (flags & NSEventModifierFlagCommand) { // HACK! When Command is held we have to more or less guess whether // we should use characters or charactersIgnoringModifiers. The // following heuristic seems to work but it may have to change. diff --git a/src/MacVim/MMVimController.m b/src/MacVim/MMVimController.m index 0d5d9b647d..8a8ab91c12 100644 --- a/src/MacVim/MMVimController.m +++ b/src/MacVim/MMVimController.m @@ -1328,7 +1328,7 @@ static BOOL isUnsafeMessage(int msgid); pt = [[windowController window] mouseLocationOutsideOfEventStream]; } - NSEvent *event = [NSEvent mouseEventWithType:NSRightMouseDown + NSEvent *event = [NSEvent mouseEventWithType:NSEventTypeRightMouseDown location:pt modifierFlags:0 timestamp:0 diff --git a/src/MacVim/MMVimView.m b/src/MacVim/MMVimView.m index 5cdb496c67..a4125ced60 100644 --- a/src/MacVim/MMVimView.m +++ b/src/MacVim/MMVimView.m @@ -197,11 +197,11 @@ enum { // weird behind the window resize throbber, so emulate the look of an // NSScrollView in the bottom right corner. if (![[self window] showsResizeIndicator] // XXX: make this a flag - || !([[self window] styleMask] & NSTexturedBackgroundWindowMask)) + || !([[self window] styleMask] & NSWindowStyleMaskTexturedBackground)) return; #if (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7) - int sw = [NSScroller scrollerWidthForControlSize:NSRegularControlSize scrollerStyle:NSScrollerStyleLegacy]; + int sw = [NSScroller scrollerWidthForControlSize:NSControlSizeRegular scrollerStyle:NSScrollerStyleLegacy]; #else int sw = [NSScroller scrollerWidth]; #endif @@ -704,7 +704,7 @@ enum { NSRect rect; #if (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7) - CGFloat scrollerWidth = [NSScroller scrollerWidthForControlSize:NSRegularControlSize scrollerStyle:NSScrollerStyleLegacy]; + CGFloat scrollerWidth = [NSScroller scrollerWidthForControlSize:NSControlSizeRegular scrollerStyle:NSScrollerStyleLegacy]; #else CGFloat scrollerWidth = [NSScroller scrollerWidth]; #endif @@ -818,7 +818,7 @@ enum { { NSSize size = textViewSize; #if (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7) - CGFloat scrollerWidth = [NSScroller scrollerWidthForControlSize:NSRegularControlSize scrollerStyle:NSScrollerStyleLegacy]; + CGFloat scrollerWidth = [NSScroller scrollerWidthForControlSize:NSControlSizeRegular scrollerStyle:NSScrollerStyleLegacy]; #else CGFloat scrollerWidth = [NSScroller scrollerWidth]; #endif @@ -840,7 +840,7 @@ enum { { NSRect rect = { {0, 0}, {contentSize.width, contentSize.height} }; #if (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7) - CGFloat scrollerWidth = [NSScroller scrollerWidthForControlSize:NSRegularControlSize scrollerStyle:NSScrollerStyleLegacy]; + CGFloat scrollerWidth = [NSScroller scrollerWidthForControlSize:NSControlSizeRegular scrollerStyle:NSScrollerStyleLegacy]; #else CGFloat scrollerWidth = [NSScroller scrollerWidth]; #endif diff --git a/src/MacVim/MMWindowController.m b/src/MacVim/MMWindowController.m index ca9db5e592..c54409e699 100644 --- a/src/MacVim/MMWindowController.m +++ b/src/MacVim/MMWindowController.m @@ -127,15 +127,15 @@ - (id)initWithVimController:(MMVimController *)controller { - unsigned styleMask = NSTitledWindowMask | NSClosableWindowMask - | NSMiniaturizableWindowMask | NSResizableWindowMask - | NSUnifiedTitleAndToolbarWindowMask - | NSTexturedBackgroundWindowMask; + unsigned styleMask = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable + | NSWindowStyleMaskMiniaturizable | NSWindowStyleMaskResizable + | NSWindowStyleMaskUnifiedTitleAndToolbar + | NSWindowStyleMaskTexturedBackground; if ([[NSUserDefaults standardUserDefaults] boolForKey:MMNoTitleBarWindowKey]) { // No title bar setting - styleMask &= ~NSTitledWindowMask; + styleMask &= ~NSWindowStyleMaskTitled; } // NOTE: The content rect is only used the very first time MacVim is @@ -175,7 +175,7 @@ [win setDelegate:self]; [win setInitialFirstResponder:[vimView textView]]; - if ([win styleMask] & NSTexturedBackgroundWindowMask) { + if ([win styleMask] & NSWindowStyleMaskTexturedBackground) { // On Leopard, we want to have a textured window to have nice // looking tabs. But the textured window look implies rounded // corners, which looks really weird -- disable them. This is a @@ -1066,8 +1066,8 @@ // Decide whether too zoom horizontally or not (always zoom vertically). NSEvent *event = [NSApp currentEvent]; - BOOL cmdLeftClick = [event type] == NSLeftMouseUp && - [event modifierFlags] & NSCommandKeyMask; + BOOL cmdLeftClick = [event type] == NSEventTypeLeftMouseUp && + [event modifierFlags] & NSEventModifierFlagCommand; BOOL zoomBoth = [[NSUserDefaults standardUserDefaults] boolForKey:MMZoomBothKey]; zoomBoth = (zoomBoth && !cmdLeftClick) || (!zoomBoth && cmdLeftClick); @@ -1179,7 +1179,7 @@ [context setDuration:0.5*duration]; [[window animator] setAlphaValue:0]; } completionHandler:^{ - [window setStyleMask:([window styleMask] | NSFullScreenWindowMask)]; + [window setStyleMask:([window styleMask] | NSWindowStyleMaskFullScreen)]; NSString *tabBarStyle = [[self class] tabBarStyleForUnified]; [[vimView tabBarControl] setStyleNamed:tabBarStyle]; [self updateTablineSeparator]; @@ -1244,7 +1244,7 @@ fullScreenEnabled = NO; [window setAlphaValue:1]; - [window setStyleMask:([window styleMask] & ~NSFullScreenWindowMask)]; + [window setStyleMask:([window styleMask] & ~NSWindowStyleMaskFullScreen)]; NSString *tabBarStyle = [[self class] tabBarStyleForMetal]; [[vimView tabBarControl] setStyleNamed:tabBarStyle]; [self updateTablineSeparator]; @@ -1275,7 +1275,7 @@ [context setDuration:0.5*duration]; [[window animator] setAlphaValue:0]; } completionHandler:^{ - [window setStyleMask:([window styleMask] & ~NSFullScreenWindowMask)]; + [window setStyleMask:([window styleMask] & ~NSWindowStyleMaskFullScreen)]; NSString *tabBarStyle = [[self class] tabBarStyleForMetal]; [[vimView tabBarControl] setStyleNamed:tabBarStyle]; [self updateTablineSeparator]; @@ -1323,7 +1323,7 @@ fullScreenEnabled = YES; [window setAlphaValue:1]; - [window setStyleMask:([window styleMask] | NSFullScreenWindowMask)]; + [window setStyleMask:([window styleMask] | NSWindowStyleMaskFullScreen)]; NSString *tabBarStyle = [[self class] tabBarStyleForUnified]; [[vimView tabBarControl] setStyleNamed:tabBarStyle]; [self updateTablineSeparator]; @@ -1513,7 +1513,7 @@ BOOL tabBarVisible = ![[vimView tabBarControl] isHidden]; BOOL toolbarHidden = [decoratedWindow toolbar] == nil; BOOL windowTextured = ([decoratedWindow styleMask] & - NSTexturedBackgroundWindowMask) != 0; + NSWindowStyleMaskTexturedBackground) != 0; BOOL hideSeparator = NO; if (fullScreenEnabled || tabBarVisible) diff --git a/src/MacVim/MacVim.h b/src/MacVim/MacVim.h index 48db665d31..a487e89c7d 100644 --- a/src/MacVim/MacVim.h +++ b/src/MacVim/MacVim.h @@ -9,8 +9,6 @@ */ #import -#import - // Taken from /usr/include/AvailabilityMacros.h #ifndef MAC_OS_X_VERSION_10_7 @@ -28,6 +26,9 @@ #ifndef MAC_OS_X_VERSION_10_11 # define MAC_OS_X_VERSION_10_11 101100 #endif +#ifndef MAC_OS_X_VERSION_10_12 +# define MAC_OS_X_VERSION_10_12 101200 +#endif // Needed for pre-10.11 SDK #ifndef NSAppKitVersionNumber10_10 @@ -37,6 +38,29 @@ # define NSAppKitVersionNumber10_10_Max 1349 #endif +#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12 +// Deprecated constants in 10.12 SDK +# define NSAlertStyleWarning NSWarningAlertStyle +# define NSControlSizeRegular NSRegularControlSize +# define NSEventModifierFlagCommand NSCommandKeyMask +# define NSEventTypeLeftMouseUp NSLeftMouseUp +# define NSEventTypeRightMouseDown NSRightMouseDown +# define NSWindowStyleMaskClosable NSClosableWindowMask +# define NSWindowStyleMaskFullScreen NSFullScreenWindowMask +# define NSWindowStyleMaskMiniaturizable NSMiniaturizableWindowMask +# define NSWindowStyleMaskResizable NSResizableWindowMask +# define NSWindowStyleMaskTexturedBackground NSTexturedBackgroundWindowMask +# define NSWindowStyleMaskTitled NSTitledWindowMask +# define NSWindowStyleMaskUnifiedTitleAndToolbar NSUnifiedTitleAndToolbarWindowMask +#endif + +#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12 +# import +# define MM_USE_ASL +#else +# import +#endif + // // This is the protocol MMBackend implements. @@ -360,7 +384,10 @@ extern int ASLogLevel; void ASLInit(); -#define ASLog(level, fmt, ...) \ +#if defined(MM_USE_ASL) + +# define MM_ASL_LEVEL_DEFAULT ASL_LEVEL_NOTICE +# define ASLog(level, fmt, ...) \ if (level <= ASLogLevel) { \ asl_log(NULL, NULL, level, "%s@%d: %s", \ __PRETTY_FUNCTION__, __LINE__, \ @@ -369,10 +396,30 @@ void ASLInit(); // Note: These macros are used like ASLogErr(@"text num=%d", 42). Objective-C // style specifiers (%@) are supported. -#define ASLogCrit(fmt, ...) ASLog(ASL_LEVEL_CRIT, fmt, ##__VA_ARGS__) -#define ASLogErr(fmt, ...) ASLog(ASL_LEVEL_ERR, fmt, ##__VA_ARGS__) -#define ASLogWarn(fmt, ...) ASLog(ASL_LEVEL_WARNING, fmt, ##__VA_ARGS__) -#define ASLogNotice(fmt, ...) ASLog(ASL_LEVEL_NOTICE, fmt, ##__VA_ARGS__) -#define ASLogInfo(fmt, ...) ASLog(ASL_LEVEL_INFO, fmt, ##__VA_ARGS__) -#define ASLogDebug(fmt, ...) ASLog(ASL_LEVEL_DEBUG, fmt, ##__VA_ARGS__) -#define ASLogTmp(fmt, ...) ASLog(ASL_LEVEL_NOTICE, fmt, ##__VA_ARGS__) +# define ASLogCrit(fmt, ...) ASLog(ASL_LEVEL_CRIT, fmt, ##__VA_ARGS__) +# define ASLogErr(fmt, ...) ASLog(ASL_LEVEL_ERR, fmt, ##__VA_ARGS__) +# define ASLogWarn(fmt, ...) ASLog(ASL_LEVEL_WARNING, fmt, ##__VA_ARGS__) +# define ASLogNotice(fmt, ...) ASLog(ASL_LEVEL_NOTICE, fmt, ##__VA_ARGS__) +# define ASLogInfo(fmt, ...) ASLog(ASL_LEVEL_INFO, fmt, ##__VA_ARGS__) +# define ASLogDebug(fmt, ...) ASLog(ASL_LEVEL_DEBUG, fmt, ##__VA_ARGS__) +# define ASLogTmp(fmt, ...) ASLog(ASL_LEVEL_NOTICE, fmt, ##__VA_ARGS__) + +#else + +# define MM_ASL_LEVEL_DEFAULT OS_LOG_TYPE_DEFAULT +# define ASLog(level, fmt, ...) \ + if (level <= ASLogLevel) { \ + os_log_with_type(OS_LOG_DEFAULT, level, "%s@%d: %s", \ + __PRETTY_FUNCTION__, __LINE__, \ + [[NSString stringWithFormat:fmt, ##__VA_ARGS__] UTF8String]); \ + } + +# define ASLogCrit(fmt, ...) ASLog(OS_LOG_TYPE_FAULT, fmt, ##__VA_ARGS__) +# define ASLogErr(fmt, ...) ASLog(OS_LOG_TYPE_ERROR, fmt, ##__VA_ARGS__) +# define ASLogWarn(fmt, ...) ASLog(OS_LOG_TYPE_DEFAULT, fmt, ##__VA_ARGS__) +# define ASLogNotice(fmt, ...) ASLog(OS_LOG_TYPE_DEFAULT, fmt, ##__VA_ARGS__) +# define ASLogInfo(fmt, ...) ASLog(OS_LOG_TYPE_INFO, fmt, ##__VA_ARGS__) +# define ASLogDebug(fmt, ...) ASLog(OS_LOG_TYPE_DEBUG, fmt, ##__VA_ARGS__) +# define ASLogTmp(fmt, ...) ASLog(OS_LOG_TYPE_DEFAULT, fmt, ##__VA_ARGS__) + +#endif diff --git a/src/MacVim/MacVim.m b/src/MacVim/MacVim.m index d889a3841c..5ff6f44503 100644 --- a/src/MacVim/MacVim.m +++ b/src/MacVim/MacVim.m @@ -124,7 +124,7 @@ NSString *MMRendererKey = @"MMRenderer"; // Vim find pasteboard type (string contains Vim regex patterns) NSString *VimFindPboardType = @"VimFindPboardType"; -int ASLogLevel = ASL_LEVEL_NOTICE; +int ASLogLevel = MM_ASL_LEVEL_DEFAULT; @@ -378,12 +378,27 @@ ASLInit() if (logLevelObj) { int logLevel = [logLevelObj intValue]; if (logLevel < 0) logLevel = 0; +#if defined(MM_USE_ASL) if (logLevel > ASL_LEVEL_DEBUG) logLevel = ASL_LEVEL_DEBUG; - - ASLogLevel = logLevel; asl_set_filter(NULL, ASL_FILTER_MASK_UPTO(logLevel)); +#else + switch (logLevel) { + case 0: case 1: case 2: + logLevel = OS_LOG_TYPE_FAULT; break; + case 3: + logLevel = OS_LOG_TYPE_ERROR; break; + case 4: case 5: + logLevel = OS_LOG_TYPE_DEFAULT; break; + case 6: + logLevel = OS_LOG_TYPE_INFO; break; + default: + logLevel = OS_LOG_TYPE_DEBUG; break; + } +#endif + ASLogLevel = logLevel; } +#if defined(MM_USE_ASL) // Allow for changing whether a copy of each log should be sent to stderr // (this defaults to NO if this key is missing in the user defaults // database). The above filter mask is applied to logs going to stderr, @@ -391,4 +406,5 @@ ASLInit() BOOL logToStdErr = [ud boolForKey:MMLogToStdErrKey]; if (logToStdErr) asl_add_log_file(NULL, 2); // The file descriptor for stderr is 2 +#endif } diff --git a/src/MacVim/Miscellaneous.m b/src/MacVim/Miscellaneous.m index 8cb83ea84c..9a80706a54 100644 --- a/src/MacVim/Miscellaneous.m +++ b/src/MacVim/Miscellaneous.m @@ -260,7 +260,7 @@ showHiddenFilesView() [button setAction:@selector(hiddenFilesButtonToggled:)]; // Use the regular control size (checkbox is a bit smaller without this) - NSControlSize buttonSize = NSRegularControlSize; + NSControlSize buttonSize = NSControlSizeRegular; float fontSize = [NSFont systemFontSizeForControlSize:buttonSize]; NSCell *theCell = [button cell]; NSFont *theFont = [NSFont fontWithName:[[theCell font] fontName] diff --git a/src/MacVim/PSMTabBarControl/source/PSMMetalTabStyle.m b/src/MacVim/PSMTabBarControl/source/PSMMetalTabStyle.m index f74d6b925a..fc1c5fae89 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMMetalTabStyle.m +++ b/src/MacVim/PSMTabBarControl/source/PSMMetalTabStyle.m @@ -303,7 +303,7 @@ void MyNSDrawWindowBackground(NSRect rect) if (!truncatingTailParagraphStyle) { truncatingTailParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain]; [truncatingTailParagraphStyle setLineBreakMode:NSLineBreakByTruncatingTail]; - [truncatingTailParagraphStyle setAlignment:NSCenterTextAlignment]; + [truncatingTailParagraphStyle setAlignment:NSTextAlignmentCenter]; } [attrStr addAttribute:NSParagraphStyleAttributeName value:truncatingTailParagraphStyle range:range]; @@ -356,7 +356,7 @@ void MyNSDrawWindowBackground(NSRect rect) // rollover if ([cell isHighlighted]) { [[NSColor colorWithCalibratedWhite:0.0 alpha:0.1] set]; - NSRectFillUsingOperation(aRect, NSCompositeSourceAtop); + NSRectFillUsingOperation(aRect, NSCompositingOperationSourceAtop); } aRect.origin.x -= 1; @@ -393,7 +393,7 @@ void MyNSDrawWindowBackground(NSRect rect) if ([cell closeButtonPressed]) closeButton = metalCloseButtonDown; closeButtonSize = [closeButton size]; - [closeButton drawInRect:closeButtonRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0 respectFlipped:YES hints:nil]; + [closeButton drawInRect:closeButtonRect fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:1.0 respectFlipped:YES hints:nil]; // scoot label over labelPosition += closeButtonSize.width + kPSMTabBarCellPadding; @@ -462,7 +462,7 @@ void MyNSDrawWindowBackground(NSRect rect) { MyNSDrawWindowBackground(rect); [[NSColor colorWithCalibratedWhite:0.0 alpha:0.2] set]; - NSRectFillUsingOperation(rect, NSCompositeSourceAtop); + NSRectFillUsingOperation(rect, NSCompositingOperationSourceAtop); [[NSColor darkGrayColor] set]; [NSBezierPath strokeLineFromPoint:NSMakePoint(rect.origin.x,rect.origin.y+0.5) toPoint:NSMakePoint(rect.origin.x+rect.size.width,rect.origin.y+0.5)]; [NSBezierPath strokeLineFromPoint:NSMakePoint(rect.origin.x,rect.origin.y+rect.size.height-0.5) toPoint:NSMakePoint(rect.origin.x+rect.size.width,rect.origin.y+rect.size.height-0.5)]; @@ -479,7 +479,7 @@ void MyNSDrawWindowBackground(NSRect rect) [attrStr addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:11.0] range:range]; if (!centeredParagraphStyle) { centeredParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain]; - [centeredParagraphStyle setAlignment:NSCenterTextAlignment]; + [centeredParagraphStyle setAlignment:NSTextAlignmentCenter]; } [attrStr addAttribute:NSParagraphStyleAttributeName value:centeredParagraphStyle range:range]; [attrStr drawInRect:labelRect]; diff --git a/src/MacVim/PSMTabBarControl/source/PSMOverflowPopUpButton.m b/src/MacVim/PSMTabBarControl/source/PSMOverflowPopUpButton.m index b991740cdb..2b36b745e2 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMOverflowPopUpButton.m +++ b/src/MacVim/PSMTabBarControl/source/PSMOverflowPopUpButton.m @@ -46,7 +46,7 @@ NSMidY(bounds) - (imageSize.height * 0.5f)); [image drawAtPoint:drawPoint fromRect:NSZeroRect - operation:NSCompositeSourceOver + operation:NSCompositingOperationSourceOver fraction:1.0f]; } diff --git a/src/MacVim/PSMTabBarControl/source/PSMTabBarCell.m b/src/MacVim/PSMTabBarControl/source/PSMTabBarCell.m index 9e57a7f42b..65b3b25052 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMTabBarCell.m +++ b/src/MacVim/PSMTabBarControl/source/PSMTabBarCell.m @@ -296,7 +296,7 @@ { if(_isPlaceholder){ [[NSColor colorWithCalibratedWhite:0.0 alpha:0.2] set]; - NSRectFillUsingOperation(cellFrame, NSCompositeSourceAtop); + NSRectFillUsingOperation(cellFrame, NSCompositingOperationSourceAtop); return; } @@ -344,7 +344,7 @@ [image addRepresentation:rep]; NSImage *returnImage = [[[NSImage alloc] initWithSize:[rep size]] autorelease]; [returnImage lockFocus]; - [image drawAtPoint:NSMakePoint(0.0, 0.0) fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:0.7]; + [image drawAtPoint:NSMakePoint(0.0, 0.0) fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:0.7]; [returnImage unlockFocus]; if(![[self indicator] isHidden]){ NSImage *pi = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"pi"]]; @@ -352,7 +352,7 @@ NSPoint indicatorPoint = NSMakePoint([self frame].size.width - MARGIN_X - kPSMTabBarIndicatorWidth, MARGIN_Y); if(([self state] == NSOnState) && ([[_controlView styleName] isEqualToString:@"Metal"])) indicatorPoint.y += 1.0; - [pi drawAtPoint:indicatorPoint fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:0.7]; + [pi drawAtPoint:indicatorPoint fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:0.7]; [returnImage unlockFocus]; [pi release]; } diff --git a/src/MacVim/PSMTabBarControl/source/PSMTabBarControl.h b/src/MacVim/PSMTabBarControl/source/PSMTabBarControl.h index 174dbe2754..4b320f4c8d 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMTabBarControl.h +++ b/src/MacVim/PSMTabBarControl/source/PSMTabBarControl.h @@ -12,6 +12,12 @@ #import +#if !defined(MAC_OS_X_VERSION_10_12) || \ + MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12 +# define NSCompositingOperationSourceOver NSCompositeSourceOver +# define NSCompositingOperationSourceAtop NSCompositeSourceAtop +# define NSTextAlignmentCenter NSCenterTextAlignment +#endif #if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_10 # define kPSMTabBarControlHeight 25 #else diff --git a/src/MacVim/PSMTabBarControl/source/PSMUnifiedTabStyle.m b/src/MacVim/PSMTabBarControl/source/PSMUnifiedTabStyle.m index bc6e38e549..56a60d3fab 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMUnifiedTabStyle.m +++ b/src/MacVim/PSMTabBarControl/source/PSMUnifiedTabStyle.m @@ -336,7 +336,7 @@ if ([cell isHighlighted]) { [[NSColor colorWithCalibratedWhite:0.0 alpha:0.1] set]; - NSRectFillUsingOperation(aRect, NSCompositeSourceAtop); + NSRectFillUsingOperation(aRect, NSCompositingOperationSourceAtop); } // frame @@ -389,7 +389,7 @@ if ([cell closeButtonPressed]) closeButton = unifiedCloseButtonDown; closeButtonSize = [closeButton size]; - [closeButton drawInRect:closeButtonRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0 respectFlipped:YES hints:nil]; + [closeButton drawInRect:closeButtonRect fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:1.0 respectFlipped:YES hints:nil]; // scoot label over labelPosition += closeButtonSize.width + kPSMTabBarCellPadding; @@ -473,7 +473,7 @@ [attrStr addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:11.0] range:range]; if (!centeredParagraphStyle) { centeredParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain]; - [centeredParagraphStyle setAlignment:NSCenterTextAlignment]; + [centeredParagraphStyle setAlignment:NSTextAlignmentCenter]; } [attrStr addAttribute:NSParagraphStyleAttributeName value:centeredParagraphStyle range:range]; [attrStr drawInRect:labelRect]; diff --git a/src/MacVim/PSMTabBarControl/source/PSMYosemiteTabStyle.m b/src/MacVim/PSMTabBarControl/source/PSMYosemiteTabStyle.m index 054c4158aa..f51cceed44 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMYosemiteTabStyle.m +++ b/src/MacVim/PSMTabBarControl/source/PSMYosemiteTabStyle.m @@ -308,7 +308,7 @@ void YosemiteNSDrawWindowBackground(NSRect rect, NSColor *color) if (!truncatingTailParagraphStyle) { truncatingTailParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain]; [truncatingTailParagraphStyle setLineBreakMode:NSLineBreakByTruncatingHead]; - [truncatingTailParagraphStyle setAlignment:NSCenterTextAlignment]; + [truncatingTailParagraphStyle setAlignment:NSTextAlignmentCenter]; } [attrStr addAttribute:NSParagraphStyleAttributeName value:truncatingTailParagraphStyle range:range]; @@ -353,7 +353,7 @@ void YosemiteNSDrawWindowBackground(NSRect rect, NSColor *color) aRect.origin.x += 0.5; [[NSColor colorWithCalibratedWhite:0.0 alpha:0.1] set]; - NSRectFillUsingOperation(aRect, NSCompositeSourceAtop); + NSRectFillUsingOperation(aRect, NSCompositingOperationSourceAtop); // frame [lineColor set]; @@ -385,7 +385,7 @@ void YosemiteNSDrawWindowBackground(NSRect rect, NSColor *color) if ([cell closeButtonPressed]) button = closeButtonDown; closeButtonSize = [button size]; - [button drawInRect:closeButtonRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0 respectFlipped:YES hints:nil]; + [button drawInRect:closeButtonRect fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:1.0 respectFlipped:YES hints:nil]; } // object counter @@ -432,7 +432,7 @@ void YosemiteNSDrawWindowBackground(NSRect rect, NSColor *color) YosemiteNSDrawWindowBackground(rect, [self backgroundColor:isKeyWindow]); [[NSColor colorWithCalibratedWhite:0.0 alpha:0.0] set]; - NSRectFillUsingOperation(rect, NSCompositeSourceAtop); + NSRectFillUsingOperation(rect, NSCompositingOperationSourceAtop); [[self borderColor] set]; [NSBezierPath strokeLineFromPoint:NSMakePoint(rect.origin.x,rect.origin.y+0.5) toPoint:NSMakePoint(rect.origin.x+rect.size.width,rect.origin.y+0.5)]; [NSBezierPath strokeLineFromPoint:NSMakePoint(rect.origin.x,rect.origin.y+rect.size.height-0.5) toPoint:NSMakePoint(rect.origin.x+rect.size.width,rect.origin.y+rect.size.height-0.5)]; @@ -449,7 +449,7 @@ void YosemiteNSDrawWindowBackground(NSRect rect, NSColor *color) [attrStr addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:11.0] range:range]; if (!centeredParagraphStyle) { centeredParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain]; - [centeredParagraphStyle setAlignment:NSCenterTextAlignment]; + [centeredParagraphStyle setAlignment:NSTextAlignmentCenter]; } [attrStr addAttribute:NSParagraphStyleAttributeName value:centeredParagraphStyle range:range]; [attrStr drawInRect:labelRect]; diff --git a/src/MacVim/gui_macvim.m b/src/MacVim/gui_macvim.m index 60aac68960..fffe01c1f3 100644 --- a/src/MacVim/gui_macvim.m +++ b/src/MacVim/gui_macvim.m @@ -1508,7 +1508,7 @@ gui_mch_dialog( gui_macvim_force_flush(); int style = NSInformationalAlertStyle; - if (VIM_WARNING == type) style = NSWarningAlertStyle; + if (VIM_WARNING == type) style = NSAlertStyleWarning; else if (VIM_ERROR == type) style = NSCriticalAlertStyle; NSMutableDictionary *attr = [NSMutableDictionary @@ -2253,7 +2253,7 @@ static int vimModMaskToEventModifierFlags(int mods) if (mods & MOD_MASK_ALT) flags |= NSAlternateKeyMask; if (mods & MOD_MASK_CMD) - flags |= NSCommandKeyMask; + flags |= NSEventModifierFlagCommand; return flags; } diff --git a/src/if_ruby.c b/src/if_ruby.c index 6a6ede81e9..0b60c38674 100644 --- a/src/if_ruby.c +++ b/src/if_ruby.c @@ -124,6 +124,7 @@ #endif #ifdef RUBY19_OR_LATER # ifdef FEAT_GUI_MACVIM +# undef SIZEOF_TIME_T # include # else # include