int _glfwPlatformInit( void ) { struct timeval tv; UInt32 nullDummy = 0; _glfwWin.MacWindow = NULL; _glfwWin.AGLContext = NULL; _glfwWin.WindowFunctions = NULL; _glfwWin.MouseUPP = NULL; _glfwWin.CommandUPP = NULL; _glfwWin.KeyboardUPP = NULL; _glfwWin.WindowUPP = NULL; _glfwInput.Modifiers = 0; _glfwLibs.OpenGLFramework = CFBundleGetBundleWithIdentifier( CFSTR( "com.apple.opengl" ) ); if( _glfwLibs.OpenGLFramework == NULL ) { return GL_FALSE; } _glfwDesktopVideoMode = CGDisplayCurrentMode( kCGDirectMainDisplay ); if( _glfwDesktopVideoMode == NULL ) { return GL_FALSE; } _glfwInitThreads(); if( !_glfwChangeToResourcesDirectory() ) { return GL_FALSE; } if( !_glfwInstallEventHandlers() ) { _glfwPlatformTerminate(); return GL_FALSE; } // Ugly hack to reduce the nasty jump that occurs at the first non- // sys keypress, caused by OS X loading certain meta scripts used // for lexical- and raw keycode translation - instead of letting // this happen while our application is running, we do some blunt // function calls in advance just to get the script caching out of // the way, BEFORE our window/screen is opened. These calls might // generate err return codes, but we don't care in this case. // NOTE: KCHRPtr is declared globally, because we need it later on. KCHRPtr = (void *)GetScriptVariable( smCurrentScript, smKCHRCache ); KeyTranslate( KCHRPtr, 0, &nullDummy ); UppercaseText( (char *)&nullDummy, 0, smSystemScript ); gettimeofday( &tv, NULL ); _glfwTimer.t0 = tv.tv_sec + (double) tv.tv_usec / 1000000.0; return GL_TRUE; }
int _glfwPlatformInit( void ) { _glfwWin.MacWindow = NULL; _glfwWin.AGLContext = NULL; _glfwWin.WindowFunctions = NULL; _glfwWin.MouseUPP = NULL; _glfwWin.CommandUPP = NULL; _glfwWin.KeyboardUPP = NULL; _glfwWin.WindowUPP = NULL; _glfwInput.Modifiers = 0; _glfwLibs.OpenGLFramework = CFBundleGetBundleWithIdentifier( CFSTR( "com.apple.opengl" ) ); if ( _glfwLibs.OpenGLFramework == NULL ) { return GL_FALSE; } _glfwDesktopVideoMode = CGDisplayCurrentMode( kCGDirectMainDisplay ); if ( _glfwDesktopVideoMode == NULL ) { return GL_FALSE; } _glfwInitThreads(); if ( !_glfwChangeToResourcesDirectory() ) { return GL_FALSE; } if ( !_glfwInstallEventHandlers() ) { _glfwPlatformTerminate(); return GL_FALSE; } _glfwTimer.t0 = GetCurrentEventTime(); return GL_TRUE; }