From: Christopher John Purnell Date: Sat, 15 Nov 2003 19:06:28 +0000 (+0000) Subject: Replace TRUE with GL_TRUE and FALSE with GL_FALSE where the type is X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=commitdiff_plain;h=074fe7a4ceb20811af83f735d5db74d69d11442c;hp=1fcc6b80990394c277a4c2ddeafab948ada650cd;p=freeglut Replace TRUE with GL_TRUE and FALSE with GL_FALSE where the type is GLboolean. git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@352 7f0cb862-5218-0410-a997-914c9d46530a --- diff --git a/src/freeglut_callbacks.c b/src/freeglut_callbacks.c index 9eee649..2c3f436 100644 --- a/src/freeglut_callbacks.c +++ b/src/freeglut_callbacks.c @@ -52,7 +52,7 @@ void FGAPIENTRY glutDisplayFunc( void (* callback)( void ) ) fgError( "Fatal error in program. NULL display callback not " "permitted in GLUT 3.0+ or freeglut 2.0.1+\n" ); SET_CALLBACK( Display ); - fgStructure.Window->State.Redisplay = TRUE; + fgStructure.Window->State.Redisplay = GL_TRUE; } /* diff --git a/src/freeglut_display.c b/src/freeglut_display.c index 059aa07..fe0ff13 100644 --- a/src/freeglut_display.c +++ b/src/freeglut_display.c @@ -42,7 +42,7 @@ void FGAPIENTRY glutPostRedisplay( void ) { freeglut_assert_ready; freeglut_assert_window; - fgStructure.Window->State.Redisplay = TRUE; + fgStructure.Window->State.Redisplay = GL_TRUE; } /* @@ -93,7 +93,7 @@ void FGAPIENTRY glutPostWindowRedisplay( int windowID ) freeglut_assert_ready; window = fgWindowByID( windowID ); freeglut_return_if_fail( window ); - window->State.Redisplay = TRUE; + window->State.Redisplay = GL_TRUE; } /*** END OF FILE ***/ diff --git a/src/freeglut_gamemode.c b/src/freeglut_gamemode.c index 21484ad..06ca767 100644 --- a/src/freeglut_gamemode.c +++ b/src/freeglut_gamemode.c @@ -262,7 +262,7 @@ GLboolean fghChangeDisplayMode( GLboolean haveToTest ) fgState.GameModeRefresh ) ) { if( haveToTest ) - return TRUE; + return GL_TRUE; /* * OKi, this is the display mode we have been looking for... */ @@ -271,7 +271,7 @@ GLboolean fghChangeDisplayMode( GLboolean haveToTest ) fgDisplay.Screen, displayModes[ i ] ); - return TRUE; + return GL_TRUE; } } } @@ -279,7 +279,7 @@ GLboolean fghChangeDisplayMode( GLboolean haveToTest ) /* * Something must have went wrong */ - return FALSE; + return GL_FALSE; # else # warning fghChangeDisplayMode: missing XFree86 video mode extensions, game mode will not change screen resolution when activated @@ -288,7 +288,7 @@ GLboolean fghChangeDisplayMode( GLboolean haveToTest ) #elif TARGET_HOST_WIN32 unsigned int displayModes = 0, mode = 0xffffffff; - GLboolean success = FALSE; + GLboolean success = GL_FALSE; /* HDC desktopDC; */ DEVMODE devMode; @@ -296,7 +296,7 @@ GLboolean fghChangeDisplayMode( GLboolean haveToTest ) * Enumerate the available display modes * Try to get a complete match */ - while( EnumDisplaySettings( NULL, displayModes, &devMode ) == TRUE ) + while( EnumDisplaySettings( NULL, displayModes, &devMode ) ) { /* * Does the enumerated display mode match the user's preferences? @@ -319,7 +319,7 @@ GLboolean fghChangeDisplayMode( GLboolean haveToTest ) /* * Enumerate the available display modes */ - while( EnumDisplaySettings( NULL, displayModes, &devMode ) == TRUE ) + while( EnumDisplaySettings( NULL, displayModes, &devMode ) ) { /* then try without Display Frequency */ if( fghCheckDisplayMode( devMode.dmPelsWidth, @@ -413,11 +413,11 @@ void FGAPIENTRY glutGameModeString( const char* string ) int FGAPIENTRY glutEnterGameMode( void ) { if( fgStructure.GameMode ) - fgAddToWindowDestroyList( fgStructure.GameMode, TRUE ); + fgAddToWindowDestroyList( fgStructure.GameMode, GL_TRUE ); else fghRememberState( ); - if( fghChangeDisplayMode( FALSE ) == FALSE ) + if( ! fghChangeDisplayMode( GL_FALSE ) ) { fgWarning( "failed to change screen settings" ); return FALSE; @@ -425,7 +425,7 @@ int FGAPIENTRY glutEnterGameMode( void ) fgStructure.GameMode = fgCreateWindow( NULL, "FREEGLUT", 0, 0, - fgState.GameModeSize.X, fgState.GameModeSize.Y, TRUE + fgState.GameModeSize.X, fgState.GameModeSize.Y, GL_TRUE ); #if TARGET_HOST_UNIX_X11 @@ -534,7 +534,7 @@ void FGAPIENTRY glutLeaveGameMode( void ) { freeglut_return_if_fail( fgStructure.GameMode ); - fgAddToWindowDestroyList( fgStructure.GameMode, TRUE ); + fgAddToWindowDestroyList( fgStructure.GameMode, GL_TRUE ); #if TARGET_HOST_UNIX_X11 @@ -557,7 +557,7 @@ int FGAPIENTRY glutGameModeGet( GLenum eWhat ) return !!fgStructure.GameMode; case GLUT_GAME_MODE_POSSIBLE: - return fghChangeDisplayMode( TRUE ); + return fghChangeDisplayMode( GL_TRUE ); case GLUT_GAME_MODE_WIDTH: return fgState.GameModeSize.X; diff --git a/src/freeglut_init.c b/src/freeglut_init.c index 70207e0..5fabb61 100644 --- a/src/freeglut_init.c +++ b/src/freeglut_init.c @@ -55,36 +55,36 @@ SFG_Display fgDisplay; /* * The settings for the current freeglut session */ -SFG_State fgState = { { -1, -1, FALSE }, /* Position */ - { 300, 300, TRUE }, /* Size */ +SFG_State fgState = { { -1, -1, GL_FALSE }, /* Position */ + { 300, 300, GL_TRUE }, /* Size */ GLUT_RGBA | GLUT_SINGLE | GLUT_DEPTH, /* DisplayMode */ - FALSE, /* Initalized */ - FALSE, /* ForceDirectContext */ - TRUE, /* TryDirectContext */ - FALSE, /* ForceIconic */ - FALSE, /* UseCurrentContext */ - FALSE, /* GLDebugSwitch */ - FALSE, /* XSyncSwitch */ - TRUE, /* IgnoreKeyRepeat */ - 0, /* FPSInterval */ - 0, /* SwapCount */ - 0, /* SwapTime */ + GL_FALSE, /* Initalized */ + GL_FALSE, /* ForceDirectContext */ + GL_TRUE, /* TryDirectContext */ + GL_FALSE, /* ForceIconic */ + GL_FALSE, /* UseCurrentContext */ + GL_FALSE, /* GLDebugSwitch */ + GL_FALSE, /* XSyncSwitch */ + GL_TRUE, /* IgnoreKeyRepeat */ + 0, /* FPSInterval */ + 0, /* SwapCount */ + 0, /* SwapTime */ #if TARGET_HOST_WIN32 - { 0, FALSE }, /* Time */ + { 0, GL_FALSE }, /* Time */ #else - { { 0, 0 }, FALSE }, + { { 0, 0 }, GL_FALSE }, #endif - { NULL, NULL } , /* Timers */ - NULL, /* IdleCallback */ - FALSE, /* BuildingAMenu */ - 0, /* ActiveMenus */ - NULL, /* MenuStateCallback */ - NULL, /* MenuStatusCallback */ - { 640, 480, TRUE }, /* GameModeSize */ - 16, /* GameModeDepth */ - 72, /* GameModeRefresh */ - GLUT_ACTION_EXIT, /* ActionOnWindowClose */ - GLUT_EXEC_STATE_INIT /* ExecState */ + { NULL, NULL }, /* Timers */ + NULL, /* IdleCallback */ + GL_FALSE, /* BuildingAMenu */ + 0, /* ActiveMenus */ + NULL, /* MenuStateCallback */ + NULL, /* MenuStatusCallback */ + { 640, 480, GL_TRUE }, /* GameModeSize */ + 16, /* GameModeDepth */ + 72, /* GameModeRefresh */ + GLUT_ACTION_EXIT, /* ActionOnWindowClose */ + GLUT_EXEC_STATE_INIT /* ExecState */ } ; @@ -239,31 +239,31 @@ void fgDeinitialize( void ) fgState.Position.X = -1; fgState.Position.Y = -1; - fgState.Position.Use = FALSE; + fgState.Position.Use = GL_FALSE; fgState.Size.X = 300; fgState.Size.Y = 300; - fgState.Size.Use = TRUE; + fgState.Size.Use = GL_TRUE; fgState.DisplayMode = GLUT_RGBA | GLUT_SINGLE | GLUT_DEPTH; - fgState.ForceDirectContext = FALSE; - fgState.TryDirectContext = TRUE; - fgState.ForceIconic = FALSE; - fgState.UseCurrentContext = FALSE; - fgState.GLDebugSwitch = FALSE; - fgState.XSyncSwitch = FALSE; + fgState.ForceDirectContext = GL_FALSE; + fgState.TryDirectContext = GL_TRUE; + fgState.ForceIconic = GL_FALSE; + fgState.UseCurrentContext = GL_FALSE; + fgState.GLDebugSwitch = GL_FALSE; + fgState.XSyncSwitch = GL_FALSE; fgState.ActionOnWindowClose = GLUT_ACTION_EXIT ; fgState.ExecState = GLUT_EXEC_STATE_INIT ; - fgState.IgnoreKeyRepeat = TRUE; + fgState.IgnoreKeyRepeat = GL_TRUE; fgState.GameModeSize.X = 640; fgState.GameModeSize.Y = 480; fgState.GameModeDepth = 16; fgState.GameModeRefresh = 72; - fgState.Time.Set = FALSE; + fgState.Time.Set = GL_FALSE; fgState.Timers.First = fgState.Timers.Last = NULL; fgState.IdleCallback = NULL; @@ -401,39 +401,39 @@ void FGAPIENTRY glutInit( int* pargc, char** argv ) } else if( strcmp( argv[ i ], "-direct" ) == 0) { - if( fgState.TryDirectContext == FALSE ) + if( ! fgState.TryDirectContext ) fgError( "parameters ambiguity, -direct and -indirect " "cannot be both specified" ); - fgState.ForceDirectContext = TRUE; + fgState.ForceDirectContext = GL_TRUE; argv[ i ] = NULL; ( *pargc )--; } else if( strcmp( argv[ i ], "-indirect" ) == 0 ) { - if( fgState.ForceDirectContext == TRUE ) + if( fgState.ForceDirectContext ) fgError( "parameters ambiguity, -direct and -indirect " "cannot be both specified" ); - fgState.TryDirectContext = FALSE; + fgState.TryDirectContext = GL_FALSE; argv[ i ] = NULL; (*pargc)--; } else if( strcmp( argv[ i ], "-iconic" ) == 0 ) { - fgState.ForceIconic = TRUE; + fgState.ForceIconic = GL_TRUE; argv[ i ] = NULL; ( *pargc )--; } else if( strcmp( argv[ i ], "-gldebug" ) == 0 ) { - fgState.GLDebugSwitch = TRUE; + fgState.GLDebugSwitch = GL_TRUE; argv[ i ] = NULL; ( *pargc )--; } else if( strcmp( argv[ i ], "-sync" ) == 0 ) { - fgState.XSyncSwitch = TRUE; + fgState.XSyncSwitch = GL_TRUE; argv[ i ] = NULL; ( *pargc )--; } @@ -471,10 +471,10 @@ void FGAPIENTRY glutInit( int* pargc, char** argv ) * Check for the minus one settings for both position and size... */ if( fgState.Position.X < 0 || fgState.Position.Y < 0 ) - fgState.Position.Use = FALSE; + fgState.Position.Use = GL_FALSE; if( fgState.Size.X < 0 || fgState.Size.Y < 0 ) - fgState.Size.Use = FALSE; + fgState.Size.Use = GL_FALSE; if( displayName ) free( displayName ); @@ -487,15 +487,15 @@ void FGAPIENTRY glutInitWindowPosition( int x, int y ) { if( ( x >= 0 ) && ( y >= 0 ) ) { - fgState.Position.X = x; - fgState.Position.Y = y; - fgState.Position.Use = TRUE; + fgState.Position.X = x; + fgState.Position.Y = y; + fgState.Position.Use = GL_TRUE; } else { - fgState.Position.X = -1; - fgState.Position.Y = -1; - fgState.Position.Use = FALSE; + fgState.Position.X = -1; + fgState.Position.Y = -1; + fgState.Position.Use = GL_FALSE; } } @@ -506,15 +506,15 @@ void FGAPIENTRY glutInitWindowSize( int width, int height ) { if( ( width > 0 ) && ( height > 0 ) ) { - fgState.Size.X = width; - fgState.Size.Y = height; - fgState.Size.Use = TRUE; + fgState.Size.X = width; + fgState.Size.Y = height; + fgState.Size.Use = GL_TRUE; } else { - fgState.Size.X = -1; - fgState.Size.Y = -1; - fgState.Size.Use = FALSE; + fgState.Size.X = -1; + fgState.Size.Y = -1; + fgState.Size.Use = GL_FALSE; } } diff --git a/src/freeglut_internal.h b/src/freeglut_internal.h index 659742b..ea75e84 100644 --- a/src/freeglut_internal.h +++ b/src/freeglut_internal.h @@ -709,7 +709,7 @@ SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title, void fgSetWindow ( SFG_Window *window ); void fgOpenWindow( SFG_Window* window, const char* title, int x, int y, int w, int h, GLboolean gameMode, - int isSubWindow ); + GLboolean isSubWindow ); void fgCloseWindow( SFG_Window* window ); void fgAddToWindowDestroyList ( SFG_Window* window, GLboolean needToClose ); diff --git a/src/freeglut_joystick.c b/src/freeglut_joystick.c index 750f255..8e469bd 100644 --- a/src/freeglut_joystick.c +++ b/src/freeglut_joystick.c @@ -185,7 +185,7 @@ static void fghJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes ) if( status != JOYERR_NOERROR ) { - joy->error = TRUE; + joy->error = GL_TRUE; return; } @@ -230,7 +230,7 @@ static void fghJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes ) } fgWarning( "%s", joy->fname ); - joy->error = TRUE; + joy->error = GL_TRUE; return; } @@ -261,7 +261,7 @@ static void fghJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes ) if( status != JS_RETURN ) { fgWarning( "%s", joy->fname ); - joy->error = TRUE; + joy->error = GL_TRUE; return; } @@ -394,7 +394,7 @@ static void fghJoystickOpen( SFG_Joystick* joy ) * I guess we have no axes at all */ default: - joy->error = TRUE; + joy->error = GL_TRUE; break; } @@ -508,7 +508,7 @@ static void fghJoystickOpen( SFG_Joystick* joy ) joy->center[ 1 ] == 512.0f ); if( counter >= 100 ) - joy->error = TRUE; + joy->error = GL_TRUE; # endif for( i = 0; i < _JS_MAX_AXES; i++ ) @@ -551,7 +551,7 @@ void fgJoystickInit( int ident ) break; default: fgJoystick->num_axes = 0; - fgJoystick->error = TRUE; + fgJoystick->error = GL_TRUE; break; } #else @@ -579,7 +579,7 @@ void fgJoystickClose( void ) fgError( "illegal attempt to deinitialize joystick device" ); #ifndef WIN32 - if( fgJoystick->error != TRUE ) + if( ! fgJoystick->error ) close( fgJoystick->fd ); #endif diff --git a/src/freeglut_main.c b/src/freeglut_main.c index 360537b..1d52c05 100644 --- a/src/freeglut_main.c +++ b/src/freeglut_main.c @@ -101,9 +101,9 @@ static void fghRedrawWindowByHandle * XXX the {window} pointer is defined. */ freeglut_return_if_fail( FETCH_WCB( *window, Display ) ); - freeglut_return_if_fail( window->State.Visible == TRUE ); + freeglut_return_if_fail( window->State.Visible ); - window->State.Redisplay = FALSE; + window->State.Redisplay = GL_FALSE; INVOKE_WCB( *window, Display, ( ) ); } @@ -139,7 +139,7 @@ static void fghReshapeWindowByHandle * But without this we get this bad behaviour whenever we resize the * window. */ - window->State.Redisplay = TRUE; + window->State.Redisplay = GL_TRUE; if( window->IsMenu ) fgSetWindow( current_window ); @@ -161,12 +161,12 @@ static void fghcbDisplayWindow( SFG_Window *window, SFG_Enumerator *enumerator ) * XXX loop if you didn't have a display callback defined... */ if( ( FETCH_WCB( *window, Display ) ) && - ( window->State.Redisplay == TRUE ) && - ( window->State.Visible == TRUE ) ) + window->State.Redisplay && + window->State.Visible ) { SFG_Window *current_window = fgStructure.Window; - window->State.Redisplay = FALSE; + window->State.Redisplay = GL_FALSE; INVOKE_WCB( *window, Display, ( ) ); fgSetWindow( current_window ); } @@ -185,7 +185,7 @@ static void fghcbDisplayWindow( SFG_Window *window, SFG_Enumerator *enumerator ) glutGet( GLUT_WINDOW_HEIGHT ) ); - window->State.NeedToResize = FALSE; + window->State.NeedToResize = GL_FALSE; fgSetWindow ( current_window ); } @@ -193,10 +193,10 @@ static void fghcbDisplayWindow( SFG_Window *window, SFG_Enumerator *enumerator ) * XXX See above comment about the Redisplay flag... */ if( ( FETCH_WCB( *window, Display ) ) && - ( window->State.Redisplay == TRUE ) && - ( window->State.Visible == TRUE ) ) + window->State.Redisplay && + window->State.Visible ) { - window->State.Redisplay = FALSE; + window->State.Redisplay = GL_FALSE; RedrawWindow( window->Window.Handle, NULL, NULL, @@ -216,8 +216,8 @@ static void fghDisplayAll( void ) { SFG_Enumerator enumerator; - enumerator.found = FALSE; - enumerator.data = NULL; + enumerator.found = GL_FALSE; + enumerator.data = NULL; fgEnumWindows( fghcbDisplayWindow, &enumerator ); } @@ -247,8 +247,8 @@ static void fghCheckJoystickPolls( void ) { SFG_Enumerator enumerator; - enumerator.found = FALSE; - enumerator.data = NULL; + enumerator.found = GL_FALSE; + enumerator.data = NULL; fgEnumWindows( fghcbCheckJoystickPolls, &enumerator ); } @@ -319,7 +319,7 @@ long fgElapsedTime( void ) #elif TARGET_HOST_WIN32 fgState.Time.Value = timeGetTime( ); #endif - fgState.Time.Set = TRUE; + fgState.Time.Set = GL_TRUE; } } @@ -385,7 +385,7 @@ static void fgCheckJoystickCallback( SFG_Window* w, SFG_Enumerator* e ) { if( FETCH_WCB( *w, Joystick ) ) { - e->found = TRUE; + e->found = GL_TRUE; e->data = w; } fgEnumSubWindows( w, fgCheckJoystickCallback, e ); @@ -393,7 +393,7 @@ static void fgCheckJoystickCallback( SFG_Window* w, SFG_Enumerator* e ) static int fgHaveJoystick( void ) { SFG_Enumerator enumerator; - enumerator.found = FALSE; + enumerator.found = GL_FALSE; enumerator.data = NULL; fgEnumWindows( fgCheckJoystickCallback, &enumerator ); return !!enumerator.data; @@ -402,7 +402,7 @@ static void fgHavePendingRedisplaysCallback( SFG_Window* w, SFG_Enumerator* e ) { if( w->State.Redisplay ) { - e->found = TRUE; + e->found = GL_TRUE; e->data = w; } fgEnumSubWindows( w, fgHavePendingRedisplaysCallback, e ); @@ -410,7 +410,7 @@ static void fgHavePendingRedisplaysCallback( SFG_Window* w, SFG_Enumerator* e ) static int fgHavePendingRedisplays( void ) { SFG_Enumerator enumerator; - enumerator.found = FALSE; + enumerator.found = GL_FALSE; enumerator.data = NULL; fgEnumWindows( fgHavePendingRedisplaysCallback, &enumerator ); return !!enumerator.data; @@ -532,7 +532,7 @@ void FGAPIENTRY glutMainLoopEvent( void ) GETWINDOW( xclient ); fgCloseWindow ( window ); - fgAddToWindowDestroyList ( window, FALSE ); + fgAddToWindowDestroyList ( window, GL_FALSE ); } break; @@ -563,7 +563,7 @@ void FGAPIENTRY glutMainLoopEvent( void ) * This is sent to confirm the XDestroyWindow call. * XXX WHY is this commented out? Should we re-enable it? */ - /* fgAddToWindowDestroyList ( window, FALSE ); */ + /* fgAddToWindowDestroyList ( window, GL_FALSE ); */ break; case Expose: @@ -611,18 +611,18 @@ void FGAPIENTRY glutMainLoopEvent( void ) { case VisibilityUnobscured: INVOKE_WCB( *window, WindowStatus, ( GLUT_FULLY_RETAINED ) ); - window->State.Visible = TRUE; + window->State.Visible = GL_TRUE; break; case VisibilityPartiallyObscured: INVOKE_WCB( *window, WindowStatus, ( GLUT_PARTIALLY_RETAINED ) ); - window->State.Visible = TRUE; + window->State.Visible = GL_TRUE; break; case VisibilityFullyObscured: INVOKE_WCB( *window, WindowStatus, ( GLUT_FULLY_COVERED ) ); - window->State.Visible = FALSE; + window->State.Visible = GL_FALSE; break; default: @@ -656,7 +656,7 @@ void FGAPIENTRY glutMainLoopEvent( void ) window->ActiveMenu->Window->State.MouseY = event.xmotion.y_root - window->ActiveMenu->Y; } - window->ActiveMenu->Window->State.Redisplay = TRUE; + window->ActiveMenu->Window->State.Redisplay = GL_TRUE; fgSetWindow( window->ActiveMenu->ParentWindow ); break; @@ -680,11 +680,11 @@ void FGAPIENTRY glutMainLoopEvent( void ) case ButtonRelease: case ButtonPress: { - GLboolean pressed = TRUE; + GLboolean pressed = GL_TRUE; int button; if( event.type == ButtonRelease ) - pressed = FALSE; + pressed = GL_FALSE; /* * A mouse button has been pressed or released. Traditionally, @@ -737,7 +737,7 @@ void FGAPIENTRY glutMainLoopEvent( void ) /* In the menu, invoke the callback and deactivate the menu*/ if( fgCheckActiveMenu( window->ActiveMenu->Window, - window->ActiveMenu ) == TRUE ) + window->ActiveMenu ) ) { /* * Save the current window and menu and set the current @@ -767,7 +767,7 @@ void FGAPIENTRY glutMainLoopEvent( void ) */ fgDeactivateMenu( window->ActiveMenu->ParentWindow ); - window->State.Redisplay = TRUE; + window->State.Redisplay = GL_TRUE; break; } @@ -779,7 +779,7 @@ void FGAPIENTRY glutMainLoopEvent( void ) ( window->Menu[ button ] ) && pressed ) { - window->State.Redisplay = TRUE; + window->State.Redisplay = GL_TRUE; fgSetWindow( window ); fgActivateMenu( window, button ); break; @@ -1104,7 +1104,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, { unsigned int current_DisplayMode = fgState.DisplayMode; fgState.DisplayMode = GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH; - fgSetupPixelFormat( window, FALSE, PFD_MAIN_PLANE ); + fgSetupPixelFormat( window, GL_FALSE, PFD_MAIN_PLANE ); fgState.DisplayMode = current_DisplayMode; if( fgStructure.MenuContext ) @@ -1124,9 +1124,9 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, } else { - fgSetupPixelFormat( window, FALSE, PFD_MAIN_PLANE ); + fgSetupPixelFormat( window, GL_FALSE, PFD_MAIN_PLANE ); - if( fgState.UseCurrentContext != TRUE ) + if( ! fgState.UseCurrentContext ) window->Window.Context = wglCreateContext( window->Window.Device ); else @@ -1138,7 +1138,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, } } - window->State.NeedToResize = TRUE; + window->State.NeedToResize = GL_TRUE; ReleaseDC( window->Window.Handle, window->Window.Device ); break; @@ -1221,8 +1221,8 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, break; case WM_SHOWWINDOW: - window->State.Visible = TRUE; - window->State.Redisplay = TRUE; + window->State.Visible = GL_TRUE; + window->State.Redisplay = GL_TRUE; break; case WM_PAINT: @@ -1264,7 +1264,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, * Put on a linked list of windows to be removed after all the * callbacks have returned */ - fgAddToWindowDestroyList( window, FALSE ); + fgAddToWindowDestroyList( window, GL_FALSE ); DestroyWindow( hWnd ); break; @@ -1281,7 +1281,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, if ( window->ActiveMenu ) { - window->State.Redisplay = TRUE; + window->State.Redisplay = GL_TRUE; fgSetWindow ( window->ActiveMenu->ParentWindow ); break; } @@ -1308,7 +1308,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, case WM_MBUTTONUP: case WM_RBUTTONUP: { - GLboolean pressed = TRUE; + GLboolean pressed = GL_TRUE; int button; window->State.MouseX = LOWORD( lParam ); @@ -1317,7 +1317,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, /* * XXX Either these multi-statement lines should be broken * XXX in the form: - * XXX pressed = TRUE; + * XXX pressed = GL_TRUE; * XXX button = GLUT_LEFT_BUTTON; * XXX break; * XXX ...or we should use a macro (much as I dislike freeglut's @@ -1326,19 +1326,19 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, switch( uMsg ) { case WM_LBUTTONDOWN: - pressed = TRUE; button = GLUT_LEFT_BUTTON; break; + pressed = GL_TRUE; button = GLUT_LEFT_BUTTON; break; case WM_MBUTTONDOWN: - pressed = TRUE; button = GLUT_MIDDLE_BUTTON; break; + pressed = GL_TRUE; button = GLUT_MIDDLE_BUTTON; break; case WM_RBUTTONDOWN: - pressed = TRUE; button = GLUT_RIGHT_BUTTON; break; + pressed = GL_TRUE; button = GLUT_RIGHT_BUTTON; break; case WM_LBUTTONUP: - pressed = FALSE; button = GLUT_LEFT_BUTTON; break; + pressed = GL_FALSE; button = GLUT_LEFT_BUTTON; break; case WM_MBUTTONUP: - pressed = FALSE; button = GLUT_MIDDLE_BUTTON; break; + pressed = GL_FALSE; button = GLUT_MIDDLE_BUTTON; break; case WM_RBUTTONUP: - pressed = FALSE; button = GLUT_RIGHT_BUTTON; break; + pressed = GL_FALSE; button = GLUT_RIGHT_BUTTON; break; default: - pressed = FALSE; button = -1; break; + pressed = GL_FALSE; button = -1; break; } if( GetSystemMetrics( SM_SWAPBUTTON ) ) @@ -1374,9 +1374,9 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, if( window->ActiveMenu ) { /* Outside the menu, deactivate the menu if it's a downclick */ - if( fgCheckActiveMenu( window, window->ActiveMenu ) != TRUE ) + if( ! fgCheckActiveMenu( window, window->ActiveMenu ) ) { - if( pressed == TRUE ) + if( pressed ) fgDeactivateMenu( window->ActiveMenu->ParentWindow ); } else /* In menu, invoke the callback and deactivate the menu*/ @@ -1405,14 +1405,14 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, * click and menu activity. */ if( ! window->IsMenu ) - window->State.Redisplay = TRUE; + window->State.Redisplay = GL_TRUE; break; } - if( ( window->Menu[ button ] ) && ( pressed == TRUE ) ) + if ( window->Menu[ button ] && pressed ) { - window->State.Redisplay = TRUE; + window->State.Redisplay = GL_TRUE; fgSetWindow( window ); fgActivateMenu( window, button ); @@ -1428,7 +1428,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, INVOKE_WCB( *window, Mouse, ( button, - pressed == TRUE ? GLUT_DOWN : GLUT_UP, + pressed ? GLUT_DOWN : GLUT_UP, window->State.MouseX, window->State.MouseY ) @@ -1713,7 +1713,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, case WM_SYNCPAINT: /* 0x0088 */ /* Another window has moved, need to update this one */ - window->State.Redisplay = TRUE; + window->State.Redisplay = GL_TRUE; lRet = DefWindowProc( hWnd, uMsg, wParam, lParam ); /* Help screen says this message must be passed to "DefWindowProc" */ break; diff --git a/src/freeglut_menu.c b/src/freeglut_menu.c index 0d00ae0..9bffdf9 100644 --- a/src/freeglut_menu.c +++ b/src/freeglut_menu.c @@ -124,7 +124,7 @@ static GLboolean fghCheckMenuStatus( SFG_Window* window, SFG_Menu* menu ) menuEntry; menuEntry = (SFG_MenuEntry *)menuEntry->Node.Next ) { - if( menuEntry->SubMenu && ( menuEntry->IsActive == TRUE ) ) + if( menuEntry->SubMenu && menuEntry->IsActive ) { /* * OK, have the sub-menu checked, too. If it returns TRUE, it @@ -138,9 +138,9 @@ static GLboolean fghCheckMenuStatus( SFG_Window* window, SFG_Menu* menu ) * Reactivate the submenu as the checkMenuStatus may have turned * it off if the mouse is in its parent menu entry. */ - menuEntry->SubMenu->IsActive = TRUE; - if ( return_status == TRUE ) - return TRUE; + menuEntry->SubMenu->IsActive = GL_TRUE; + if ( return_status ) + return GL_TRUE; } } @@ -153,9 +153,9 @@ static GLboolean fghCheckMenuStatus( SFG_Window* window, SFG_Menu* menu ) for( menuEntry = (SFG_MenuEntry *)menu->Entries.First; menuEntry; menuEntry = (SFG_MenuEntry *)menuEntry->Node.Next ) - menuEntry->IsActive = FALSE; + menuEntry->IsActive = GL_FALSE; - menu->IsActive = FALSE; + menu->IsActive = GL_FALSE; /* * Check if the mouse cursor is contained within the current menu box @@ -174,7 +174,7 @@ static GLboolean fghCheckMenuStatus( SFG_Window* window, SFG_Menu* menu ) menuEntry = fghFindMenuEntry( menu, menuID + 1 ); assert( menuEntry ); - menuEntry->IsActive = TRUE; + menuEntry->IsActive = GL_TRUE; menuEntry->Ordinal = menuID; /* @@ -187,7 +187,7 @@ static GLboolean fghCheckMenuStatus( SFG_Window* window, SFG_Menu* menu ) fgDeactivateSubMenu( menu->ActiveEntry ); menu->ActiveEntry = menuEntry; - menu->IsActive = TRUE; + menu->IsActive = GL_TRUE; /* * OKi, we have marked that entry as active, but it would be also @@ -203,7 +203,7 @@ static GLboolean fghCheckMenuStatus( SFG_Window* window, SFG_Menu* menu ) /* * Set up the initial menu position now... */ - menuEntry->SubMenu->IsActive = TRUE; + menuEntry->SubMenu->IsActive = GL_TRUE; /* * Set up the initial submenu position now: @@ -239,19 +239,19 @@ static GLboolean fghCheckMenuStatus( SFG_Window* window, SFG_Menu* menu ) /* * Activate it because its parent entry is active */ - menuEntry->SubMenu->IsActive = TRUE; + menuEntry->SubMenu->IsActive = GL_TRUE; } /* * Report back that we have caught the menu cursor */ - return TRUE; + return GL_TRUE; } /* * Looks like the menu cursor is somewhere else... */ - return FALSE; + return GL_FALSE; } /* @@ -307,7 +307,7 @@ static void fghDisplayMenuBox( SFG_Menu* menu ) /* * Has the menu been marked as active, maybe? */ - if( menuEntry->IsActive == TRUE ) + if( menuEntry->IsActive ) { /* * That's truly right, and we need to have it highlighted. @@ -397,7 +397,7 @@ static void fghDisplayMenuBox( SFG_Menu* menu ) /* * Is that an active sub menu by any case? */ - if( menuEntry->SubMenu && ( menuEntry->IsActive == TRUE ) ) + if( menuEntry->SubMenu && menuEntry->IsActive ) { /* * Yeah, indeed. Have it redrawn now: @@ -495,7 +495,7 @@ void fgActivateMenu( SFG_Window* window, int button ) * Mark the menu as active, so that it gets displayed: */ window->ActiveMenu = menu; - menu->IsActive = TRUE; + menu->IsActive = GL_TRUE; fgState.ActiveMenus++; /* @@ -552,7 +552,7 @@ void fgExecuteMenuCallback( SFG_Menu* menu ) menuEntry; menuEntry = (SFG_MenuEntry *)menuEntry->Node.Next) { - if( menuEntry->IsActive == TRUE ) + if( menuEntry->IsActive ) { if( menuEntry->SubMenu ) fgExecuteMenuCallback( menuEntry->SubMenu ); @@ -593,7 +593,7 @@ void fgDeactivateMenu( SFG_Window *window ) */ menu->Window->ActiveMenu = NULL; menu->ParentWindow->ActiveMenu = NULL; - menu->IsActive = FALSE; + menu->IsActive = GL_FALSE; fgState.ActiveMenus--; @@ -631,7 +631,7 @@ void fgDeactivateSubMenu( SFG_MenuEntry *menuEntry ) * Forget about having that menu active anymore, now: */ menuEntry->SubMenu->Window->ActiveMenu = NULL; - menuEntry->SubMenu->IsActive = FALSE; + menuEntry->SubMenu->IsActive = GL_FALSE; /* * Hide all submenu windows, and the root menu's window. diff --git a/src/freeglut_misc.c b/src/freeglut_misc.c index f8b7f33..d950d0a 100644 --- a/src/freeglut_misc.c +++ b/src/freeglut_misc.c @@ -99,7 +99,7 @@ void FGAPIENTRY glutReportErrors( void ) */ void FGAPIENTRY glutIgnoreKeyRepeat( int ignore ) { - fgState.IgnoreKeyRepeat = ignore ? TRUE : FALSE; + fgState.IgnoreKeyRepeat = ignore ? GL_TRUE : GL_FALSE; } /* diff --git a/src/freeglut_state.c b/src/freeglut_state.c index 0ddceaf..3c1ae79 100644 --- a/src/freeglut_state.c +++ b/src/freeglut_state.c @@ -105,7 +105,7 @@ void FGAPIENTRY glutSetOption( GLenum eWhat, int value ) case GLUT_RENDERING_CONTEXT: fgState.UseCurrentContext = - ( value == GLUT_USE_CURRENT_CONTEXT ) ? TRUE : FALSE; + ( value == GLUT_USE_CURRENT_CONTEXT ) ? GL_TRUE : GL_FALSE; break; case GLUT_WINDOW_CURSOR: @@ -400,7 +400,8 @@ int FGAPIENTRY glutGet( GLenum eWhat ) return ( GetSystemMetrics( SM_CYCAPTION ) ) ; case GLUT_DISPLAY_MODE_POSSIBLE: - return( fgSetupPixelFormat( fgStructure.Window, TRUE, PFD_MAIN_PLANE ) ); + return( fgSetupPixelFormat( fgStructure.Window, GL_TRUE, + PFD_MAIN_PLANE ) ); case GLUT_WINDOW_FORMAT_ID: if( fgStructure.Window != NULL ) @@ -620,7 +621,8 @@ int FGAPIENTRY glutLayerGet( GLenum eWhat ) #elif TARGET_HOST_WIN32 case GLUT_OVERLAY_POSSIBLE: -/* return( fgSetupPixelFormat( fgStructure.Window, TRUE, PFD_OVERLAY_PLANE ) ); */ +/* return( fgSetupPixelFormat( fgStructure.Window, GL_TRUE, + PFD_OVERLAY_PLANE ) ); */ return FALSE ; case GLUT_LAYER_IN_USE: diff --git a/src/freeglut_structure.c b/src/freeglut_structure.c index 8a19aff..2871e32 100644 --- a/src/freeglut_structure.c +++ b/src/freeglut_structure.c @@ -113,7 +113,7 @@ SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title, * dependant, and resides in freeglut_window.c. Uses fgState. */ fgOpenWindow( window, title, x, y, w, h, gameMode, - (parent != NULL) ? TRUE : FALSE ); + parent ? GL_TRUE : GL_FALSE ); return window; } @@ -146,9 +146,9 @@ SFG_Menu* fgCreateMenu( FGCBMenu menuCallback ) * global variable BuildingAMenu to true so we can ensure * it is created without decorations. */ - fgState.BuildingAMenu = TRUE; + fgState.BuildingAMenu = GL_TRUE; - fgCreateWindow( NULL, NULL, x, y, w, h, FALSE ); + fgCreateWindow( NULL, NULL, x, y, w, h, GL_FALSE ); menu->Window = fgStructure.Window; glutDisplayFunc( fgDisplayMenu ); @@ -156,7 +156,7 @@ SFG_Menu* fgCreateMenu( FGCBMenu menuCallback ) * While BuildingAMenu is true, all windows built have no decorations. * That's not a good default behavior, so let's set it false again. */ - fgState.BuildingAMenu = FALSE; + fgState.BuildingAMenu = GL_FALSE; glutHideWindow( ); /* Hide the window for now */ fgSetWindow( current_window ); @@ -318,7 +318,7 @@ void fgDestroyWindow( SFG_Window* window, GLboolean needToClose ) } fgClearCallBacks( window ); - if( needToClose == TRUE ) + if( needToClose ) fgCloseWindow( window ); free( window ); if( fgStructure.Window == window ) @@ -425,7 +425,7 @@ void fgDestroyMenu( SFG_Menu* menu ) if( fgStructure.Window == menu->Window ) fgSetWindow( menu->ParentWindow ); - fgDestroyWindow( menu->Window, TRUE ); + fgDestroyWindow( menu->Window, GL_TRUE ); fgListRemove( &fgStructure.Menus, &menu->Node ); if( fgStructure.Menu == menu ) fgStructure.Menu = NULL; @@ -470,7 +470,7 @@ void fgDestroyStructure( void ) fgDestroyMenu( menu ); while( window = ( SFG_Window * )fgStructure.Windows.First ) - fgDestroyWindow( window, TRUE ); + fgDestroyWindow( window, GL_TRUE ); } /* @@ -491,7 +491,7 @@ void fgEnumWindows( FGCBenumerator enumCallback, SFG_Enumerator* enumerator ) window = ( SFG_Window * )window->Node.Next ) { enumCallback( window, enumerator ); - if( enumerator->found == TRUE ) + if( enumerator->found ) return; } } @@ -513,7 +513,7 @@ void fgEnumSubWindows( SFG_Window* window, FGCBenumerator enumCallback, child = ( SFG_Window * )child->Node.Next ) { enumCallback( child, enumerator ); - if( enumerator->found == TRUE ) + if( enumerator->found ) return; } } @@ -524,7 +524,8 @@ void fgEnumSubWindows( SFG_Window* window, FGCBenumerator enumCallback, static void fghcbWindowByHandle( SFG_Window *window, SFG_Enumerator *enumerator ) { - freeglut_return_if_fail( enumerator->found == FALSE ); + if ( enumerator->found ) + return; #if TARGET_HOST_UNIX_X11 #define WBHANDLE (Window) @@ -537,7 +538,7 @@ static void fghcbWindowByHandle( SFG_Window *window, */ if( window->Window.Handle == WBHANDLE (enumerator->data) ) { - enumerator->found = TRUE; + enumerator->found = GL_TRUE; enumerator->data = window; return; @@ -568,11 +569,11 @@ SFG_Window* fgWindowByHandle /* * This is easy and makes use of the windows enumeration defined above */ - enumerator.found = FALSE; + enumerator.found = GL_FALSE; enumerator.data = (void *)hWindow; fgEnumWindows( fghcbWindowByHandle, &enumerator ); - if( enumerator.found == TRUE ) + if( enumerator.found ) return( SFG_Window *) enumerator.data; return NULL; } @@ -585,14 +586,15 @@ static void fghcbWindowByID( SFG_Window *window, SFG_Enumerator *enumerator ) /* * Make sure we do not overwrite our precious results... */ - freeglut_return_if_fail( enumerator->found == FALSE ); + if ( enumerator->found ) + return; /* * Check the window's handle. Hope this works. Looks ugly. That's for sure. */ if( window->ID == (int) (enumerator->data) ) /* XXX int/ptr conversion! */ { - enumerator->found = TRUE; + enumerator->found = GL_TRUE; enumerator->data = window; return; @@ -616,10 +618,10 @@ SFG_Window* fgWindowByID( int windowID ) /* * Uses a method very similiar for fgWindowByHandle... */ - enumerator.found = FALSE; + enumerator.found = GL_FALSE; enumerator.data = (void *) windowID; /* XXX int/pointer conversion! */ fgEnumWindows( fghcbWindowByID, &enumerator ); - if( enumerator.found == TRUE ) + if( enumerator.found ) return( SFG_Window *) enumerator.data; return NULL; } diff --git a/src/freeglut_window.c b/src/freeglut_window.c index 4820ad0..907696d 100644 --- a/src/freeglut_window.c +++ b/src/freeglut_window.c @@ -66,7 +66,7 @@ XVisualInfo* fgChooseVisual( void ) { #define BUFFER_SIZES 6 int bufferSize[BUFFER_SIZES] = { 16, 12, 8, 4, 2, 1 }; - GLboolean wantIndexedMode = FALSE; + GLboolean wantIndexedMode = GL_FALSE; int attributes[ 32 ]; int where = 0; @@ -83,7 +83,7 @@ XVisualInfo* fgChooseVisual( void ) if( fgState.DisplayMode & GLUT_INDEX ) { ATTRIB_VAL( GLX_BUFFER_SIZE, 8 ); - wantIndexedMode = TRUE; + wantIndexedMode = GL_TRUE; } else { @@ -121,7 +121,7 @@ XVisualInfo* fgChooseVisual( void ) */ ATTRIB( None ); - if( wantIndexedMode == FALSE ) + if( ! wantIndexedMode ) return glXChooseVisual( fgDisplay.Display, fgDisplay.Screen, attributes ); else @@ -204,10 +204,10 @@ GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly, pixelformat = ChoosePixelFormat( window->Window.Device, ppfd ); if( pixelformat == 0 ) - return FALSE; + return GL_FALSE; if( checkOnly ) - return TRUE; + return GL_TRUE; return SetPixelFormat( window->Window.Device, pixelformat, ppfd ); } #endif @@ -249,7 +249,7 @@ void fgSetWindow ( SFG_Window *window ) */ void fgOpenWindow( SFG_Window* window, const char* title, int x, int y, int w, int h, - GLboolean gameMode, int isSubWindow ) + GLboolean gameMode, GLboolean isSubWindow ) { #if TARGET_HOST_UNIX_X11 XSetWindowAttributes winAttr; @@ -370,7 +370,7 @@ void fgOpenWindow( SFG_Window* window, const char* title, NULL, fgState.ForceDirectContext | fgState.TryDirectContext ); } - else if ( fgState.UseCurrentContext == TRUE ) + else if ( fgState.UseCurrentContext ) { window->Window.Context = glXGetCurrentContext(); @@ -401,12 +401,12 @@ void fgOpenWindow( SFG_Window* window, const char* title, * XXX Assume the new window is visible by default * XXX Is this a safe assumption? */ - window->State.Visible = TRUE; + window->State.Visible = GL_TRUE; sizeHints.flags = 0; - if (fgState.Position.Use == TRUE) + if ( fgState.Position.Use ) sizeHints.flags |= USPosition; - if (fgState.Size.Use == TRUE) + if ( fgState.Size.Use ) sizeHints.flags |= USSize; /* @@ -423,8 +423,7 @@ void fgOpenWindow( SFG_Window* window, const char* title, sizeHints.height = h; wmHints.flags = StateHint; - wmHints.initial_state = - (fgState.ForceIconic == FALSE) ? NormalState : IconicState; + wmHints.initial_state = fgState.ForceIconic ? IconicState : NormalState; /* * Prepare the window and iconified window names... @@ -460,7 +459,7 @@ void fgOpenWindow( SFG_Window* window, const char* title, atom = GetClassInfo( fgDisplay.Instance, "FREEGLUT", &wc ); assert( atom != 0 ); - if( gameMode != FALSE ) + if( gameMode ) { assert( window->Parent == NULL ); @@ -472,7 +471,7 @@ void fgOpenWindow( SFG_Window* window, const char* title, } else { - if ( ( !isSubWindow ) && ( ! window->IsMenu ) ) + if ( ( ! isSubWindow ) && ( ! window->IsMenu ) ) { /* * Update the window dimensions, taking account of window @@ -484,12 +483,12 @@ void fgOpenWindow( SFG_Window* window, const char* title, GetSystemMetrics( SM_CYCAPTION ); } - if( fgState.Position.Use == FALSE ) + if( ! fgState.Position.Use ) { x = CW_USEDEFAULT; y = CW_USEDEFAULT; } - if( fgState.Size.Use == FALSE ) + if( ! fgState.Size.Use ) { w = CW_USEDEFAULT; h = CW_USEDEFAULT; @@ -574,7 +573,7 @@ void fgCloseWindow( SFG_Window* window ) int FGAPIENTRY glutCreateWindow( const char* title ) { return fgCreateWindow( NULL, title, fgState.Position.X, fgState.Position.Y, - fgState.Size.X, fgState.Size.Y, FALSE )->ID; + fgState.Size.X, fgState.Size.Y, GL_FALSE )->ID; } /* @@ -588,7 +587,7 @@ int FGAPIENTRY glutCreateSubWindow( int parentID, int x, int y, int w, int h ) freeglut_assert_ready; parent = fgWindowByID( parentID ); freeglut_return_val_if_fail( parent != NULL, 0 ); - window = fgCreateWindow( parent, "", x, y, w, h, FALSE ); + window = fgCreateWindow( parent, "", x, y, w, h, GL_FALSE ); return window->ID; } @@ -601,7 +600,7 @@ void FGAPIENTRY glutDestroyWindow( int windowID ) freeglut_return_if_fail( window != NULL ); { fgExecutionState ExecState = fgState.ExecState; - fgAddToWindowDestroyList( window, TRUE ); + fgAddToWindowDestroyList( window, GL_TRUE ); fgState.ExecState = ExecState; } } @@ -658,7 +657,7 @@ void FGAPIENTRY glutShowWindow( void ) #endif - fgStructure.Window->State.Redisplay = TRUE; + fgStructure.Window->State.Redisplay = GL_TRUE; } /* @@ -684,7 +683,7 @@ void FGAPIENTRY glutHideWindow( void ) #endif - fgStructure.Window->State.Redisplay = FALSE; + fgStructure.Window->State.Redisplay = GL_FALSE; } /* @@ -707,7 +706,7 @@ void FGAPIENTRY glutIconifyWindow( void ) #endif - fgStructure.Window->State.Redisplay = FALSE; + fgStructure.Window->State.Redisplay = GL_FALSE; } /*