macOS: Address more compiler warnings when building with a recent deployment target.

Alex Szpakowski 2017-07-13 23:09:37 -03:00
parent bc3ede1ed0
commit 562473c1f4
4 changed files with 23 additions and 5 deletions

View File

@ -394,6 +394,7 @@ void
Cocoa_PumpEvents(_THIS) Cocoa_PumpEvents(_THIS)
{ @autoreleasepool { @autoreleasepool
{ {
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
/* Update activity every 30 seconds to prevent screensaver */ /* Update activity every 30 seconds to prevent screensaver */
SDL_VideoData *data = (SDL_VideoData *)_this->driverdata; SDL_VideoData *data = (SDL_VideoData *)_this->driverdata;
if (_this->suspend_screensaver && !data->screensaver_use_iopm) { if (_this->suspend_screensaver && !data->screensaver_use_iopm) {
@ -404,6 +405,7 @@ Cocoa_PumpEvents(_THIS)
data->screensaver_activity = now; data->screensaver_activity = now;
} }
} }
#endif
for ( ; ; ) { for ( ; ; ) {
NSEvent *event = [NSApp nextEventMatchingMask:NSEventMaskAny untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES ]; NSEvent *event = [NSApp nextEventMatchingMask:NSEventMaskAny untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES ];

View File

@ -143,10 +143,13 @@
aRange.location, aRange.length, windowHeight, aRange.location, aRange.length, windowHeight,
NSStringFromRect(rect)); NSStringFromRect(rect));
if ([window respondsToSelector:@selector(convertRectToScreen:)]) { #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
rect = [window convertRectToScreen:rect]; if (![window respondsToSelector:@selector(convertRectToScreen:)]) {
} else {
rect.origin = [window convertBaseToScreen:rect.origin]; rect.origin = [window convertBaseToScreen:rect.origin];
} else
#endif
{
rect = [window convertRectToScreen:rect];
} }
return rect; return rect;

View File

@ -57,11 +57,24 @@
- (void)showAlert:(NSAlert*)alert - (void)showAlert:(NSAlert*)alert
{ {
if (nswindow) { if (nswindow) {
[alert beginSheetModalForWindow:nswindow modalDelegate:self didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) contextInfo:nil]; #ifdef MAC_OS_X_VERSION_10_9
if ([alert respondsToSelector:@selector(beginSheetModalForWindow:completionHandler:)]) {
[alert beginSheetModalForWindow:nswindow completionHandler:^(NSModalResponse returnCode) {
clicked = returnCode;
}];
} else
#endif
{
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1090
[alert beginSheetModalForWindow:nswindow modalDelegate:self didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) contextInfo:nil];
#endif
}
while (clicked < 0) { while (clicked < 0) {
SDL_PumpEvents(); SDL_PumpEvents();
SDL_Delay(100); SDL_Delay(100);
} }
[nswindow release]; [nswindow release];
} else { } else {
clicked = [alert runModal]; clicked = [alert runModal];

View File

@ -86,7 +86,7 @@ static const unsigned int NSWindowStyleMaskUtilityWindow = NSUtilityWindowMask;
static const unsigned int NSWindowStyleMaskDocModalWindow = NSDocModalWindowMask; static const unsigned int NSWindowStyleMaskDocModalWindow = NSDocModalWindowMask;
#undef DECLARE_WINDOW_MASK #undef DECLARE_WINDOW_MASK
#define DECLARE_ALERT_STYLE(name) static NSUInteger NSAlertStyle##name = NS##name##AlertStyle #define DECLARE_ALERT_STYLE(name) static const NSUInteger NSAlertStyle##name = NS##name##AlertStyle
DECLARE_ALERT_STYLE(Warning); DECLARE_ALERT_STYLE(Warning);
DECLARE_ALERT_STYLE(Informational); DECLARE_ALERT_STYLE(Informational);
DECLARE_ALERT_STYLE(Critical); DECLARE_ALERT_STYLE(Critical);