SetFrontProcess is deprecated, use NSApplication instead now we
have the CocoaHelpers file.
*/
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
\ No newline at end of file
return result;
}
+
+void transformToForegroundApp()
+{
+ ProcessSerialNumber sn = { 0, kCurrentProcess };
+ TransformProcessType(&sn,kProcessTransformToForegroundApplication);
+
+
+ [[NSApplication sharedApplication] activateIgnoringOtherApps: YES];
+}
#include "fg_os.hxx"
#if defined(SG_MAC)
-#include <Carbon/Carbon.h>
+ #include <GUI/CocoaHelpers.h> // for transformToForegroundApp
#endif
std::string homedir;
#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