From 9fdf3dc2fb2b5b68a83b10a57b99679f31874804 Mon Sep 17 00:00:00 2001 From: Kazuki Sakamoto Date: Fri, 20 Nov 2015 23:51:27 -0800 Subject: [PATCH] Fix beginSheetModalForWindow warning in a proper way --- src/MacVim/MMVimController.m | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/MacVim/MMVimController.m b/src/MacVim/MMVimController.m index 2080643d12..fe588048fe 100644 --- a/src/MacVim/MMVimController.m +++ b/src/MacVim/MMVimController.m @@ -71,6 +71,8 @@ static BOOL isUnsafeMessage(int msgid); } - (void)setTextFieldString:(NSString *)textFieldString; - (NSTextField *)textField; +- (void)beginSheetModalForWindow:(NSWindow *)window + modalDelegate:(id)delegate; @end @@ -1533,9 +1535,7 @@ static BOOL isUnsafeMessage(int msgid); } [alert beginSheetModalForWindow:[windowController window] - modalDelegate:self - didEndSelector:@selector(alertDidEnd:code:context:) - contextInfo:NULL]; + modalDelegate:self]; [alert release]; } @@ -1602,13 +1602,19 @@ static BOOL isUnsafeMessage(int msgid); - (void)beginSheetModalForWindow:(NSWindow *)window modalDelegate:(id)delegate - didEndSelector:(SEL)didEndSelector - contextInfo:(void *)contextInfo { + +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_10 + [super beginSheetModalForWindow:window + completionHandler:^(NSModalResponse code) { + [delegate alertDidEnd:self code:code context:NULL]; + }]; +#else [super beginSheetModalForWindow:window modalDelegate:delegate - didEndSelector:didEndSelector - contextInfo:contextInfo]; + didEndSelector:@selector(alertDidEnd:code:context:) + contextInfo:NULL]; +#endif // HACK! Place the input text field at the bottom of the informative text // (which has been made a bit larger by adding newline characters).