]> git.mxchange.org Git - flightgear.git/commitdiff
Cocoa: fix warning about deprecated function.
authorJames Turner <zakalawe@mac.com>
Sat, 21 Dec 2013 15:29:11 +0000 (15:29 +0000)
committerJames Turner <zakalawe@mac.com>
Sat, 21 Dec 2013 15:31:27 +0000 (15:31 +0000)
SetFrontProcess is deprecated, use NSApplication instead now we
have the CocoaHelpers file.

src/GUI/CocoaHelpers.h
src/GUI/CocoaHelpers.mm
src/Main/bootstrap.cxx

index 9b4802a2814532b9f73f0f155cddab87cbe1e768..9c999778e746400d889d9c694a32adadac75159e 100644 (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
\ No newline at end of file
index cc564a2b0c3714d29e50fb2180ba80e93ee0211b..70454f1f41e17c77635b5d4790906651d7502685 100644 (file)
@@ -151,3 +151,12 @@ string_list FGLocale::getUserLanguage()
     
     return result;
 }
+
+void transformToForegroundApp()
+{
+    ProcessSerialNumber sn = { 0, kCurrentProcess };
+    TransformProcessType(&sn,kProcessTransformToForegroundApplication);
+
+    
+    [[NSApplication sharedApplication] activateIgnoringOtherApps: YES];
+}
index 2b5cb2b262c062372f233b5d23da6e075392028e..be6c595b584038734310cfd1829d2827e0f563cc 100644 (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