Skip to content

Commit

Permalink
Suppress deprecated macOS API compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
gkv311 committed Jun 6, 2017
1 parent 48c6227 commit ff4bea1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions StCore/StWindowImplMac.mm
Expand Up @@ -274,7 +274,9 @@ StRectI_t aRectSlave(getSlaveTop(), getSlaveTop() + getSlaveHeight(),
StCocoaLocalPool aLocalPool;

const bool isNoAccel = false;
ST_DISABLE_DEPRECATION_WARNINGS
const NSOpenGLPixelFormatAttribute aDummyAttrib = NSOpenGLPFACompliant;
ST_ENABLE_DEPRECATION_WARNINGS
NSOpenGLPixelFormatAttribute anAttribs[] = {
attribs.IsGlStereo ? NSOpenGLPFAStereo : aDummyAttrib,
//NSOpenGLPFAColorSize, 32,
Expand Down
2 changes: 2 additions & 0 deletions StShared/StCocoaCoords.mm
Expand Up @@ -42,7 +42,9 @@
CGDirectDisplayID aDispId = [aNumber unsignedIntValue];
CGRect aRect = CGDisplayBounds(aDispId);
myScreenBottom = aRect.origin.y + aRect.size.height;
ST_DISABLE_DEPRECATION_WARNINGS
myScale = [aScreen userSpaceScaleFactor];
ST_ENABLE_DEPRECATION_WARNINGS
myUnScale = 1.0 / myScale;
return true;
}
Expand Down
2 changes: 2 additions & 0 deletions StShared/StFileNode.ObjC.mm
Expand Up @@ -68,12 +68,14 @@ - (void ) doDialog: (id ) theSender {
[aFilePanel setAllowedFileTypes: myFilter];
}

ST_DISABLE_DEPRECATION_WARNINGS
if([aFilePanel runModal] == NSOKButton) {
myIsFileSelected = true;
// automatically convert filenames from decomposed form used by Mac OS X file systems
NSString* aFileName = [[aFilePanel filename] precomposedStringWithCanonicalMapping];
myResult = [aFileName UTF8String];
}
ST_ENABLE_DEPRECATION_WARNINGS
}

@end
Expand Down
8 changes: 8 additions & 0 deletions StShared/StLogger.ObjC.mm
Expand Up @@ -22,7 +22,9 @@
StLogger::GetDefault().write(theMessage, StLogger::ST_INFO);
StCocoaLocalPool aLocalPool;
NSString* aMessage = [NSString stringWithUTF8String: theMessage.toCString()];
ST_DISABLE_DEPRECATION_WARNINGS
NSRunAlertPanel(@"Info", @"%@", @"OK", nil, nil, aMessage);
ST_ENABLE_DEPRECATION_WARNINGS
}

void StMessageBox::Warn(const StString& theMessage) {
Expand All @@ -32,7 +34,9 @@
StLogger::GetDefault().write(theMessage, StLogger::ST_WARNING);
StCocoaLocalPool aLocalPool;
NSString* aMessage = [NSString stringWithUTF8String: theMessage.toCString()];
ST_DISABLE_DEPRECATION_WARNINGS
NSRunAlertPanel(@"Warning", @"%@", @"OK", nil, nil, aMessage);
ST_ENABLE_DEPRECATION_WARNINGS
}

void StMessageBox::Error(const StString& theMessage) {
Expand All @@ -42,7 +46,9 @@
StLogger::GetDefault().write(theMessage, StLogger::ST_ERROR);
StCocoaLocalPool aLocalPool;
NSString* aMessage = [NSString stringWithUTF8String: theMessage.toCString()];
ST_DISABLE_DEPRECATION_WARNINGS
NSRunAlertPanel(@"Error", @"%@", @"OK", nil, nil, aMessage);
ST_ENABLE_DEPRECATION_WARNINGS
}

bool StMessageBox::Question(const StString& theMessage) {
Expand All @@ -51,8 +57,10 @@
}
StCocoaLocalPool aLocalPool;
NSString* aMessage = [NSString stringWithUTF8String: theMessage.toCString()];
ST_DISABLE_DEPRECATION_WARNINGS
int aResult = NSRunAlertPanel(@"Question", @"%@", @"Yes", @"No", nil, aMessage);
return aResult == NSAlertDefaultReturn;
ST_ENABLE_DEPRECATION_WARNINGS
}

#endif // __APPLE__

0 comments on commit ff4bea1

Please sign in to comment.