1
0
Fork 0

Cocoa: fix warning about deprecated function.

SetFrontProcess is deprecated, use NSApplication instead now we
have the CocoaHelpers file.
This commit is contained in:
James Turner 2013-12-21 15:29:11 +00:00
parent f650fe5abd
commit 4c51ad0d87
3 changed files with 18 additions and 4 deletions

View file

@ -34,4 +34,11 @@ void cocoaOpenUrl(const std::string& url);
*/
SGPath platformDefaultDataPath();
/**
* When we run non-bundled, we need to transform to a GUI (foreground) app
* osgViewer does this for us normally, but we need to do it ourselves
* to show a message box before OSG is initialized.
*/
void transformToForegroundApp();
#endif // of FG_GUI_COCOA_HELPERS_H

View file

@ -151,3 +151,12 @@ string_list FGLocale::getUserLanguage()
return result;
}
void transformToForegroundApp()
{
ProcessSerialNumber sn = { 0, kCurrentProcess };
TransformProcessType(&sn,kProcessTransformToForegroundApplication);
[[NSApplication sharedApplication] activateIgnoringOtherApps: YES];
}

View file

@ -64,7 +64,7 @@ using std::endl;
#include "fg_os.hxx"
#if defined(SG_MAC)
#include <Carbon/Carbon.h>
#include <GUI/CocoaHelpers.h> // for transformToForegroundApp
#endif
std::string homedir;
@ -164,9 +164,7 @@ int main ( int argc, char **argv )
#if defined(SG_MAC)
// required so native messages boxes work prior to osgViewer init
// (only needed when not running as a bundled app)
ProcessSerialNumber sn = { 0, kCurrentProcess };
TransformProcessType(&sn,kProcessTransformToForegroundApplication);
SetFrontProcess(&sn);
transformToForegroundApp();
#endif
#ifdef PTW32_STATIC_LIB