-# ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H
-
- /*
- * This is also used by applications which check modes by calling
- * glutGameModeGet(GLUT_GAME_MODE_POSSIBLE), so allow the check:
- */
- if( haveToTest || fgDisplay.pDisplay.DisplayModeValid )
- {
- XF86VidModeModeInfo** displayModes;
- int i, displayModesCount;
-
- /* If we don't have a valid modeline in the display structure, which
- * can happen if this is called from glutGameModeGet instead of
- * glutEnterGameMode, then we need to query the current mode, to make
- * unspecified settings to default to their current values.
- */
- if(!fgDisplay.pDisplay.DisplayModeValid) {
- if(!XF86VidModeGetModeLine(fgDisplay.pDisplay.Display, fgDisplay.pDisplay.Screen,
- &fgDisplay.pDisplay.DisplayModeClock, &fgDisplay.pDisplay.DisplayMode)) {
- return success;
- }
- }
-
- if (fgState.GameModeSize.X == -1)
- {
- fgState.GameModeSize.X = fgDisplay.pDisplay.DisplayMode.hdisplay;
- }
- if (fgState.GameModeSize.Y == -1)
- {
- fgState.GameModeSize.Y = fgDisplay.pDisplay.DisplayMode.vdisplay;
- }
- if (fgState.GameModeDepth == -1)
- {
- /* can't get color depth from this, nor can we change it, do nothing
- * TODO: get with XGetVisualInfo()? but then how to set?
- */
- }
- if (fgState.GameModeRefresh == -1)
- {
- /* Compute the displays refresh rate, dotclock comes in kHz. */
- int refresh = ( fgDisplay.pDisplay.DisplayModeClock * 1000 ) /
- ( fgDisplay.pDisplay.DisplayMode.htotal * fgDisplay.pDisplay.DisplayMode.vtotal );
-
- fgState.GameModeRefresh = refresh;
- }
-
- /* query all possible display modes */
- if( !XF86VidModeGetAllModeLines(
- fgDisplay.pDisplay.Display,
- fgDisplay.pDisplay.Screen,
- &displayModesCount,
- &displayModes ) )
- {
- fgWarning( "XF86VidModeGetAllModeLines failed" );
- return success;
- }
-
-
- /*
- * Check every of the modes looking for one that matches our demands,
- * ignoring the refresh rate if no exact match could be found.
- */
- i = fghCheckDisplayModes( GL_TRUE, displayModesCount, displayModes );
- if( i < 0 ) {
- i = fghCheckDisplayModes( GL_FALSE, displayModesCount, displayModes );
- }
- success = ( i < 0 ) ? GL_FALSE : GL_TRUE;
-
- if( !haveToTest && success ) {
- if( !XF86VidModeSwitchToMode(
- fgDisplay.pDisplay.Display,
- fgDisplay.pDisplay.Screen,
- displayModes[ i ] ) )
- fgWarning( "XF86VidModeSwitchToMode failed" );
- }
-
- XFree( displayModes );
- }
-
-# endif
+#ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H
+ if(use_xf86vm()) {
+ /*
+ * This is also used by applications which check modes by calling
+ * glutGameModeGet(GLUT_GAME_MODE_POSSIBLE), so allow the check:
+ */
+ if( haveToTest || fgDisplay.pDisplay.DisplayModeValid )
+ {
+ XF86VidModeModeInfo** displayModes;
+ int i, displayModesCount;
+
+ /* If we don't have a valid modeline in the display structure, which
+ * can happen if this is called from glutGameModeGet instead of
+ * glutEnterGameMode, then we need to query the current mode, to make
+ * unspecified settings to default to their current values.
+ */
+ if(!fgDisplay.pDisplay.DisplayModeValid) {
+ if(!XF86VidModeGetModeLine(fgDisplay.pDisplay.Display, fgDisplay.pDisplay.Screen,
+ &fgDisplay.pDisplay.DisplayModeClock, &fgDisplay.pDisplay.DisplayMode)) {
+ return success;
+ }
+ }
+
+ if (fgState.GameModeSize.X == -1)
+ {
+ fgState.GameModeSize.X = fgDisplay.pDisplay.DisplayMode.hdisplay;
+ }
+ if (fgState.GameModeSize.Y == -1)
+ {
+ fgState.GameModeSize.Y = fgDisplay.pDisplay.DisplayMode.vdisplay;
+ }
+ if (fgState.GameModeDepth == -1)
+ {
+ /* can't get color depth from this, nor can we change it, do nothing
+ * TODO: get with XGetVisualInfo()? but then how to set?
+ */
+ }
+ if (fgState.GameModeRefresh == -1)
+ {
+ /* Compute the displays refresh rate, dotclock comes in kHz. */
+ int refresh = ( fgDisplay.pDisplay.DisplayModeClock * 1000 ) /
+ ( fgDisplay.pDisplay.DisplayMode.htotal * fgDisplay.pDisplay.DisplayMode.vtotal );
+
+ fgState.GameModeRefresh = refresh;
+ }
+
+ /* query all possible display modes */
+ if( !XF86VidModeGetAllModeLines(
+ fgDisplay.pDisplay.Display,
+ fgDisplay.pDisplay.Screen,
+ &displayModesCount,
+ &displayModes ) )
+ {
+ fgWarning( "XF86VidModeGetAllModeLines failed" );
+ return success;
+ }
+
+
+ /*
+ * Check every of the modes looking for one that matches our demands,
+ * ignoring the refresh rate if no exact match could be found.
+ */
+ i = fghCheckDisplayModes( GL_TRUE, displayModesCount, displayModes );
+ if( i < 0 ) {
+ i = fghCheckDisplayModes( GL_FALSE, displayModesCount, displayModes );
+ }
+ success = ( i < 0 ) ? GL_FALSE : GL_TRUE;
+
+ if( !haveToTest && success ) {
+ if( !XF86VidModeSwitchToMode(
+ fgDisplay.pDisplay.Display,
+ fgDisplay.pDisplay.Screen,
+ displayModes[ i ] ) )
+ fgWarning( "XF86VidModeSwitchToMode failed" );
+ }
+
+ XFree( displayModes );
+ }
+ }
+
+#endif /* HAVE_X11_EXTENSIONS_XF86VMODE_H */