]> git.mxchange.org Git - flightgear.git/commitdiff
Darrell Walisser:
authorcurt <curt>
Tue, 10 Sep 2002 19:43:33 +0000 (19:43 +0000)
committercurt <curt>
Tue, 10 Sep 2002 19:43:33 +0000 (19:43 +0000)
This allows it to behave like a certified Mac OS X citizen.

src/Main/main.cxx

index 9dc0a8d29a10097569d420c9da651e75a39d95e0..9114a36f64503de10e01423f9c07857f8f225ffd 100644 (file)
@@ -356,6 +356,7 @@ void trRenderFrame( void ) {
     // a completely dark scene.  So, we set GL_LIGHT_MODEL_AMBIENT
     // explicitely to black.
     glLightModelfv( GL_LIGHT_MODEL_AMBIENT, black );
+    // glLightModeli( GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE );
 
     ssgGetLight( 0 ) -> setColour( GL_AMBIENT, l->scene_ambient );
 
@@ -711,6 +712,15 @@ void fgRenderFrame() {
         ssgSetNearFar( scene_nearplane, scene_farplane );
        ssgCullAndDraw( globals->get_scenery()->get_lighting() );
 
+       //static int _frame_count = 0;
+       //if (_frame_count % 30 == 0) {
+       //  printf("SSG: %s\n", ssgShowStats());
+       //}
+       //else {
+       //  ssgShowStats();
+       //}
+       //_frame_count++;
+
 
 #ifdef FG_EXPERIMENTAL_LIGHTING
        if (glutExtensionSupported("GL_EXT_point_parameters")) {
@@ -1657,6 +1667,25 @@ handleFPE (int num)
 }
 #endif
 
+#ifdef __APPLE__
+
+typedef struct
+{
+  int  lo;
+  int  hi;
+} PSN;
+
+extern "C" {
+  short CPSGetCurrentProcess(PSN *psn);
+  short CPSSetProcessName (PSN *psn, char *processname);
+  short CPSEnableForegroundOperation(PSN *psn, int _arg2, int _arg3, int _arg4, int _arg5);
+  short CPSSetFrontProcess(PSN *psn);
+};
+
+#define CPSEnableFG(psn) CPSEnableForegroundOperation(psn,0x03,0x3C,0x2C,0x1103)
+
+#endif
+
 // Main entry point; catch any exceptions that have made it this far.
 int main ( int argc, char **argv ) {
 
@@ -1675,6 +1704,20 @@ int main ( int argc, char **argv ) {
     _control87(MCW_EM, MCW_EM);  /* defined in float.h */
 #endif
 
+    // Keyboard focus hack
+#ifdef __APPLE__
+    {
+      PSN psn;
+
+      glutInit (&argc, argv);
+
+      CPSGetCurrentProcess(&psn);
+      CPSSetProcessName(&psn, "FlightGear");
+      CPSEnableFG(&psn);
+      CPSSetFrontProcess(&psn);
+    }
+#endif
+
     // FIXME: add other, more specific
     // exceptions.
     try {