X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=freeglut-1.3%2Ffreeglut_gamemode.c;h=5b4eff306f70957e03364f126b5ee3710286c550;hb=0983e031026a0350741095e076c83c73e28a637f;hp=13f25267e5b385f55a8813abef4cce12bf2bf17a;hpb=d0dde87efb130eeb45fe61dd63b582432b972606;p=freeglut diff --git a/freeglut-1.3/freeglut_gamemode.c b/freeglut-1.3/freeglut_gamemode.c index 13f2526..5b4eff3 100644 --- a/freeglut-1.3/freeglut_gamemode.c +++ b/freeglut-1.3/freeglut_gamemode.c @@ -32,7 +32,7 @@ #define G_LOG_DOMAIN "freeglut-gamemode" #include "../include/GL/freeglut.h" -#include "../include/GL/freeglut_internal.h" +#include "freeglut_internal.h" /* * TODO BEFORE THE STABLE RELEASE: @@ -82,9 +82,9 @@ void fghRememberState( void ) */ /* hack to get around my stupid cross-gcc headers */ -#define ENUM_CURRENT_SETTINGS -1 +#define FREEGLUT_ENUM_CURRENT_SETTINGS -1 - EnumDisplaySettings( NULL, ENUM_CURRENT_SETTINGS, &fgDisplay.DisplayMode ); + EnumDisplaySettings( NULL, FREEGLUT_ENUM_CURRENT_SETTINGS, &fgDisplay.DisplayMode ); /* * Make sure we will be restoring all settings needed @@ -137,6 +137,15 @@ void fghRestoreState( void ) displayModes[ i ] ); + /* + * In case this will be the last X11 call we do before exit, + * we've to flush the X11 output queue to be sure the command + * is really brought onto it's way to the X server. + * The application should not do this because it + * would not be platform independent then. + */ + XFlush(fgDisplay.Display); + return; } } @@ -200,6 +209,8 @@ GLboolean fghChangeDisplayMode( GLboolean haveToTest ) if( fghCheckDisplayMode( displayModes[ i ]->hdisplay, displayModes[ i ]->vdisplay, fgState.GameModeDepth, fgState.GameModeRefresh ) ) { + if( haveToTest ) + return( TRUE ); /* * OKi, this is the display mode we have been looking for... */ @@ -254,7 +265,7 @@ GLboolean fghChangeDisplayMode( GLboolean haveToTest ) devMode.dmBitsPerPel, fgState.GameModeRefresh ) ) { /* - * OKi, we've found a matching display mode, remember it's number and break + * OKi, we've found a matching display mode, remember its number and break */ mode = displayModes; break; @@ -355,7 +366,7 @@ int FGAPIENTRY glutEnterGameMode( void ) /* * ...if so, delete it before proceeding... */ - fgDestroyWindow( fgStructure.GameMode, TRUE ); + fgAddToWindowDestroyList( fgStructure.GameMode, TRUE ); } else { @@ -370,7 +381,7 @@ int FGAPIENTRY glutEnterGameMode( void ) */ if( fghChangeDisplayMode( FALSE ) == FALSE ) { - fgWarning( "failed to change screen settings" ); + fgWarning( "failed to change screen settings" ); return( FALSE ); } @@ -434,9 +445,9 @@ void FGAPIENTRY glutLeaveGameMode( void ) freeglut_return_if_fail( fgStructure.GameMode != NULL ); /* - * First of all, have the game mode window created + * First of all, have the game mode window destroyed */ - fgDestroyWindow( fgStructure.GameMode, TRUE ); + fgAddToWindowDestroyList( fgStructure.GameMode, TRUE ); #if TARGET_HOST_UNIX_X11