(234) Fixed part of bug #926883 (Video mode matching code, memory leaks,
fullscreen): Now we first try to get an exact mode match, ignoring the refresh rate if none could be found. This way the X11 part and the WinDoze behave similarly. NOTE: We still don't behave like GLUT, because it has a wider notion of "best" match. We have to refactor and extend freeglut quite a bit to do that. git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@558 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
parent
f7ef083831
commit
c70e6634ff
@ -895,3 +895,10 @@ default.
|
|||||||
(233) Fixed part of bug #926883 (Video mode matching code, memory leaks,
|
(233) Fixed part of bug #926883 (Video mode matching code, memory leaks,
|
||||||
fullscreen), i.e. memory leak caused by not freeing the mode lines returned
|
fullscreen), i.e. memory leak caused by not freeing the mode lines returned
|
||||||
by XF86VidModeGetAllModeLines
|
by XF86VidModeGetAllModeLines
|
||||||
|
|
||||||
|
(234) Fixed part of bug #926883 (Video mode matching code, memory leaks,
|
||||||
|
fullscreen): Now we first try to get an exact mode match, ignoring the
|
||||||
|
refresh rate if none could be found. This way the X11 part and the WinDoze
|
||||||
|
behave similarly. NOTE: We still don't behave like GLUT, because it has a
|
||||||
|
wider notion of "best" match. We have to refactor and extend freeglut quite
|
||||||
|
a bit to do that.
|
||||||
|
@ -234,7 +234,7 @@ static GLboolean fghChangeDisplayMode( GLboolean haveToTest )
|
|||||||
if( haveToTest || fgDisplay.DisplayModeValid )
|
if( haveToTest || fgDisplay.DisplayModeValid )
|
||||||
{
|
{
|
||||||
XF86VidModeModeInfo** displayModes;
|
XF86VidModeModeInfo** displayModes;
|
||||||
int i, displayModesCount;
|
int i, ignoreRefreshRate, displayModesCount;
|
||||||
|
|
||||||
XF86VidModeGetAllModeLines(
|
XF86VidModeGetAllModeLines(
|
||||||
fgDisplay.Display,
|
fgDisplay.Display,
|
||||||
@ -243,26 +243,33 @@ static GLboolean fghChangeDisplayMode( GLboolean haveToTest )
|
|||||||
&displayModes
|
&displayModes
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Check every of the modes looking for one that matches our demands */
|
/*
|
||||||
for( i = 0; i < displayModesCount; i++ )
|
* Check every of the modes looking for one that matches our demands,
|
||||||
|
* ignoring the refresh rate if no exact match could be found.
|
||||||
|
*/
|
||||||
|
for( ignoreRefreshRate = 0;
|
||||||
|
!success && ( ignoreRefreshRate <= 1 );
|
||||||
|
ignoreRefreshRate++)
|
||||||
{
|
{
|
||||||
if( fghCheckDisplayMode( displayModes[ i ]->hdisplay,
|
for( i = 0;
|
||||||
displayModes[ i ]->vdisplay,
|
!success && ( i < displayModesCount );
|
||||||
fgState.GameModeDepth,
|
i++ )
|
||||||
fgState.GameModeRefresh ) )
|
|
||||||
{
|
{
|
||||||
/* OKi, this is the display mode we have been looking for... */
|
/* Compute the displays refresh rate, dotclock comes in kHz. */
|
||||||
if( !haveToTest ) {
|
int refresh = ( displayModes[ i ]->dotclock * 1000 ) /
|
||||||
XF86VidModeSwitchToMode(
|
( displayModes[ i ]->htotal * displayModes[ i ]->vtotal );
|
||||||
fgDisplay.Display,
|
|
||||||
fgDisplay.Screen,
|
success = fghCheckDisplayMode( displayModes[ i ]->hdisplay,
|
||||||
displayModes[ i ]
|
displayModes[ i ]->vdisplay,
|
||||||
);
|
fgState.GameModeDepth,
|
||||||
}
|
( ignoreRefreshRate ? fgState.GameModeRefresh : refresh ) );
|
||||||
success = GL_TRUE;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( !haveToTest && success ) {
|
||||||
|
XF86VidModeSwitchToMode( fgDisplay.Display, fgDisplay.Screen, displayModes[ i ] );
|
||||||
|
}
|
||||||
|
|
||||||
XFree( displayModes );
|
XFree( displayModes );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user