From 2ed4ed5b52426ef4817676d3a348ec11cd6afea9 Mon Sep 17 00:00:00 2001 From: jtsiomb Date: Mon, 18 Aug 2014 00:52:53 +0000 Subject: [PATCH 1/2] changed the X11 gamemode code policy. Falling back to xf86vm when xrandr fails was problematic when passing invalid modes. Now instead, if xrandr is available, we use that, and only that. XF86VM is now only used when XR&R is not supported at all. I also added a set of env vars to artificially disable one or the other, or both. If FREEGLUT_NO_XRANDR is set we completely ignore XR&R, and if FREEGLUT_NO_XF86VM is set, we completely ignore XF86VidMode. Obviously if both are defined or missing, game mode can't switch resolutions at all any more, but that's a nice debugging aid, and may be useful to allow the user to pick which extension he'd rather use for mode switching. git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1695 7f0cb862-5218-0410-a997-914c9d46530a --- freeglut/freeglut/src/x11/fg_gamemode_x11.c | 451 +++++++++++--------- 1 file changed, 243 insertions(+), 208 deletions(-) diff --git a/freeglut/freeglut/src/x11/fg_gamemode_x11.c b/freeglut/freeglut/src/x11/fg_gamemode_x11.c index 5df4edc..c329ddc 100644 --- a/freeglut/freeglut/src/x11/fg_gamemode_x11.c +++ b/freeglut/freeglut/src/x11/fg_gamemode_x11.c @@ -29,17 +29,53 @@ #include #include "../fg_internal.h" +/* we'll try to use XR&R if it's available at compile-time, and at runtime, and the user + * hasn't explicitly disabled it by setting the FREEGLUT_NO_XRANDR env-var. + */ +static int use_xrandr(void) +{ +#ifdef HAVE_X11_EXTENSIONS_XRANDR_H + int event_base, error_base; + if(!XRRQueryExtension(fgDisplay.pDisplay.Display, &event_base, &error_base)) { + return 0; + } + if(getenv("FREEGLUT_NO_XRANDR")) { + return 0; + } + return 1; +#else + return 0; /* no compile-time support */ +#endif +} + +/* we'll try to use XF86VidMode if it's available at compile-time, and at runtime, and the + * user hasn't explicitly disabled it by setting the FREEGLUT_NO_XF86VM env-var. + */ +static int use_xf86vm(void) +{ +#ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H + int event_base, error_base; + if(!XF86VidModeQueryExtension(fgDisplay.pDisplay.Display, &event_base, &error_base)) { + return 0; + } + if(getenv("FREEGLUT_NO_XF86VM")) { + return 0; + } + return 1; +#else + return 0; /* no compile-time support */ +#endif +} + + #ifdef HAVE_X11_EXTENSIONS_XRANDR_H static int xrandr_resize(int xsz, int ysz, int rate, int just_checking) { - int event_base, error_base, ver_major, ver_minor, use_rate; + int ver_major, ver_minor, use_rate; XRRScreenConfiguration *xrr_config = 0; Status result = -1; - /* must check at runtime for the availability of the extension */ - if(!XRRQueryExtension(fgDisplay.pDisplay.Display, &event_base, &error_base)) { - return -1; - } + /* NOTE: we have already determined that XR&R is availble and enabled before calling this */ XRRQueryVersion(fgDisplay.pDisplay.Display, &ver_major, &ver_minor); @@ -147,10 +183,6 @@ static int xrandr_resize(int xsz, int ysz, int rate, int just_checking) */ void fgPlatformRememberState( void ) { -# if defined(HAVE_X11_EXTENSIONS_XRANDR_H) | defined(HAVE_X11_EXTENSIONS_XF86VMODE_H) - int event_base, error_base; -# endif - /* * Remember the current pointer location before going fullscreen * for restoring it later: @@ -164,7 +196,7 @@ void fgPlatformRememberState( void ) &fgDisplay.pDisplay.DisplayPointerX, &fgDisplay.pDisplay.DisplayPointerY, &junk_mask); # ifdef HAVE_X11_EXTENSIONS_XRANDR_H - if(XRRQueryExtension(fgDisplay.pDisplay.Display, &event_base, &error_base)) { + if(use_xrandr()) { XRRScreenConfiguration *xrr_config; XRRScreenSize *ssizes; Rotation rot; @@ -189,40 +221,38 @@ void fgPlatformRememberState( void ) XRRFreeScreenConfigInfo(xrr_config); } } -# endif +# endif /* HAVE_X11_EXTENSIONS_XRANDR_H */ /* * This highly depends on the XFree86 extensions, * not approved as X Consortium standards */ # ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H - if(!XF86VidModeQueryExtension(fgDisplay.pDisplay.Display, &event_base, &error_base)) { - return; - } - - /* - * Remember the current ViewPort location of the screen to be able to - * restore the ViewPort on LeaveGameMode(): - */ - if( !XF86VidModeGetViewPort( - fgDisplay.pDisplay.Display, - fgDisplay.pDisplay.Screen, - &fgDisplay.pDisplay.DisplayViewPortX, - &fgDisplay.pDisplay.DisplayViewPortY ) ) - fgWarning( "XF86VidModeGetViewPort failed" ); + if(use_xf86vm()) { + /* + * Remember the current ViewPort location of the screen to be able to + * restore the ViewPort on LeaveGameMode(): + */ + if( !XF86VidModeGetViewPort( + fgDisplay.pDisplay.Display, + fgDisplay.pDisplay.Screen, + &fgDisplay.pDisplay.DisplayViewPortX, + &fgDisplay.pDisplay.DisplayViewPortY ) ) + fgWarning( "XF86VidModeGetViewPort failed" ); - /* Query the current display settings: */ - fgDisplay.pDisplay.DisplayModeValid = - XF86VidModeGetModeLine( - fgDisplay.pDisplay.Display, - fgDisplay.pDisplay.Screen, - &fgDisplay.pDisplay.DisplayModeClock, - &fgDisplay.pDisplay.DisplayMode - ); + /* Query the current display settings: */ + fgDisplay.pDisplay.DisplayModeValid = + XF86VidModeGetModeLine( + fgDisplay.pDisplay.Display, + fgDisplay.pDisplay.Screen, + &fgDisplay.pDisplay.DisplayModeClock, + &fgDisplay.pDisplay.DisplayMode + ); - if( !fgDisplay.pDisplay.DisplayModeValid ) - fgWarning( "XF86VidModeGetModeLine failed" ); + if( !fgDisplay.pDisplay.DisplayModeValid ) + fgWarning( "XF86VidModeGetModeLine failed" ); + } # endif } @@ -238,90 +268,90 @@ void fgPlatformRestoreState( void ) fgDisplay.pDisplay.DisplayPointerX, fgDisplay.pDisplay.DisplayPointerY ); - -# ifdef HAVE_X11_EXTENSIONS_XRANDR_H - if(fgDisplay.pDisplay.prev_size_valid) { - if(xrandr_resize(fgDisplay.pDisplay.prev_xsz, fgDisplay.pDisplay.prev_ysz, fgDisplay.pDisplay.prev_refresh, 0) != -1) { - fgDisplay.pDisplay.prev_size_valid = 0; -# ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H - fgDisplay.pDisplay.DisplayModeValid = 0; -# endif - return; - } +#ifdef HAVE_X11_EXTENSIONS_XRANDR_H + if(use_xrandr()) { + if(fgDisplay.pDisplay.prev_size_valid) { + if(xrandr_resize(fgDisplay.pDisplay.prev_xsz, fgDisplay.pDisplay.prev_ysz, fgDisplay.pDisplay.prev_refresh, 0) != -1) { + fgDisplay.pDisplay.prev_size_valid = 0; +#ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H + fgDisplay.pDisplay.DisplayModeValid = 0; +#endif + } + } + return; /* don't fall back to XF86VidMode if we have XR&R */ } -# endif +#endif /* HAVE_X11_EXTENSIONS_XRANDR_H */ -# ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H +#ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H /* * This highly depends on the XFree86 extensions, * not approved as X Consortium standards */ + if(use_xf86vm()) { - if( fgDisplay.pDisplay.DisplayModeValid ) - { - XF86VidModeModeInfo** displayModes; - int i, displayModesCount; + if( fgDisplay.pDisplay.DisplayModeValid ) + { + XF86VidModeModeInfo** displayModes; + int i, displayModesCount; - if( !XF86VidModeGetAllModeLines( - fgDisplay.pDisplay.Display, - fgDisplay.pDisplay.Screen, - &displayModesCount, - &displayModes ) ) - { - fgWarning( "XF86VidModeGetAllModeLines failed" ); - return; - } + if( !XF86VidModeGetAllModeLines( + fgDisplay.pDisplay.Display, + fgDisplay.pDisplay.Screen, + &displayModesCount, + &displayModes ) ) + { + fgWarning( "XF86VidModeGetAllModeLines failed" ); + return; + } - /* - * Check every of the modes looking for one that matches our demands. - * If we find one, switch to it and restore the remembered viewport. - */ - for( i = 0; i < displayModesCount; i++ ) - { - if(displayModes[ i ]->hdisplay == fgDisplay.pDisplay.DisplayMode.hdisplay && - displayModes[ i ]->vdisplay == fgDisplay.pDisplay.DisplayMode.vdisplay && - displayModes[ i ]->dotclock == fgDisplay.pDisplay.DisplayModeClock ) - { - if( !XF86VidModeSwitchToMode( - fgDisplay.pDisplay.Display, - fgDisplay.pDisplay.Screen, - displayModes[ i ] ) ) - { - fgWarning( "XF86VidModeSwitchToMode failed" ); - break; - } + /* + * Check every of the modes looking for one that matches our demands. + * If we find one, switch to it and restore the remembered viewport. + */ + for( i = 0; i < displayModesCount; i++ ) + { + if(displayModes[ i ]->hdisplay == fgDisplay.pDisplay.DisplayMode.hdisplay && + displayModes[ i ]->vdisplay == fgDisplay.pDisplay.DisplayMode.vdisplay && + displayModes[ i ]->dotclock == fgDisplay.pDisplay.DisplayModeClock ) + { + if( !XF86VidModeSwitchToMode( + fgDisplay.pDisplay.Display, + fgDisplay.pDisplay.Screen, + displayModes[ i ] ) ) + { + fgWarning( "XF86VidModeSwitchToMode failed" ); + break; + } - if( !XF86VidModeSetViewPort( - fgDisplay.pDisplay.Display, - fgDisplay.pDisplay.Screen, - fgDisplay.pDisplay.DisplayViewPortX, - fgDisplay.pDisplay.DisplayViewPortY ) ) - fgWarning( "XF86VidModeSetViewPort failed" ); + if( !XF86VidModeSetViewPort( + fgDisplay.pDisplay.Display, + fgDisplay.pDisplay.Screen, + fgDisplay.pDisplay.DisplayViewPortX, + fgDisplay.pDisplay.DisplayViewPortY ) ) + fgWarning( "XF86VidModeSetViewPort failed" ); - /* - * For the case this would be the last X11 call the application - * calls exit() we've to flush the X11 output queue to have the - * commands sent to the X server before the application exits. - */ - XFlush( fgDisplay.pDisplay.Display ); + /* + * For the case this would be the last X11 call the application + * calls exit() we've to flush the X11 output queue to have the + * commands sent to the X server before the application exits. + */ + XFlush( fgDisplay.pDisplay.Display ); - fgDisplay.pDisplay.DisplayModeValid = 0; -# ifdef HAVE_X11_EXTENSIONS_XRANDR_H - fgDisplay.pDisplay.prev_size_valid = 0; -# endif - - break; - } - } - XFree( displayModes ); + fgDisplay.pDisplay.DisplayModeValid = 0; +#ifdef HAVE_X11_EXTENSIONS_XRANDR_H + fgDisplay.pDisplay.prev_size_valid = 0; +#endif + break; + } + } + XFree( displayModes ); + } } - -# endif - +#endif /* HAVE_X11_EXTENSIONS_XF86VMODE_H */ } #ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H @@ -378,105 +408,108 @@ static int fghCheckDisplayModes( GLboolean exactMatch, int displayModesCount, XF GLboolean fgPlatformChangeDisplayMode( GLboolean haveToTest ) { GLboolean success = GL_FALSE; - /* first try to use XRandR, then fallback to XF86VidMode */ -# ifdef HAVE_X11_EXTENSIONS_XRANDR_H - if(xrandr_resize(fgState.GameModeSize.X, fgState.GameModeSize.Y, - fgState.GameModeRefresh, haveToTest) != -1) { - return GL_TRUE; - } -# endif +#ifdef HAVE_X11_EXTENSIONS_XRANDR_H + if(use_xrandr()) { + if(xrandr_resize(fgState.GameModeSize.X, fgState.GameModeSize.Y, + fgState.GameModeRefresh, haveToTest) != -1) { + return GL_TRUE; + } + return GL_FALSE; /* don't fall back to XF86VidMode */ + } +#endif /* HAVE_X11_EXTENSIONS_XRANDR_H */ /* * This highly depends on the XFree86 extensions, * not approved as X Consortium standards */ -# ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H +#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; - /* - * 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 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 ); - 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; + } - fgState.GameModeRefresh = refresh; - } - - /* query all possible display modes */ - if( !XF86VidModeGetAllModeLines( - fgDisplay.pDisplay.Display, - fgDisplay.pDisplay.Screen, - &displayModesCount, - &displayModes ) ) - { - fgWarning( "XF86VidModeGetAllModeLines failed" ); - return success; - } + /* 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; + /* + * 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" ); - } + if( !haveToTest && success ) { + if( !XF86VidModeSwitchToMode( + fgDisplay.pDisplay.Display, + fgDisplay.pDisplay.Screen, + displayModes[ i ] ) ) + fgWarning( "XF86VidModeSwitchToMode failed" ); + } - XFree( displayModes ); - } + XFree( displayModes ); + } + } -# endif +#endif /* HAVE_X11_EXTENSIONS_XF86VMODE_H */ return success; } -void fgPlatformEnterGameMode( void ) +void fgPlatformEnterGameMode( void ) { /* @@ -521,38 +554,40 @@ void fgPlatformEnterGameMode( void ) fgState.GameModeSize.X/2, fgState.GameModeSize.Y/2 ); -# ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H +#ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H + if(use_xf86vm()) { - if( fgDisplay.pDisplay.DisplayModeValid ) - { - int x, y; - Window child; + if( fgDisplay.pDisplay.DisplayModeValid ) + { + int x, y; + Window child; - /* Change to viewport to the window topleft edge: */ - if( !XF86VidModeSetViewPort( fgDisplay.pDisplay.Display, fgDisplay.pDisplay.Screen, 0, 0 ) ) - fgWarning( "XF86VidModeSetViewPort failed" ); + /* Change to viewport to the window topleft edge: */ + if( !XF86VidModeSetViewPort( fgDisplay.pDisplay.Display, fgDisplay.pDisplay.Screen, 0, 0 ) ) + fgWarning( "XF86VidModeSetViewPort failed" ); - /* - * Final window repositioning: It could be avoided using an undecorated - * window using override_redirect, but this * would possily require - * more changes and investigation. - */ + /* + * Final window repositioning: It could be avoided using an undecorated + * window using override_redirect, but this * would possily require + * more changes and investigation. + */ - /* Get the current postion of the drawable area on screen */ - XTranslateCoordinates( - fgDisplay.pDisplay.Display, - fgStructure.CurrentWindow->Window.Handle, - fgDisplay.pDisplay.RootWindow, - 0, 0, &x, &y, - &child - ); + /* Get the current postion of the drawable area on screen */ + XTranslateCoordinates( + fgDisplay.pDisplay.Display, + fgStructure.CurrentWindow->Window.Handle, + fgDisplay.pDisplay.RootWindow, + 0, 0, &x, &y, + &child + ); - /* Move the decorataions out of the topleft corner of the display */ - XMoveWindow( fgDisplay.pDisplay.Display, fgStructure.CurrentWindow->Window.Handle, - -x, -y); - } + /* Move the decorataions out of the topleft corner of the display */ + XMoveWindow( fgDisplay.pDisplay.Display, fgStructure.CurrentWindow->Window.Handle, + -x, -y); + } + } -#endif +#endif /* HAVE_X11_EXTENSIONS_XF86VMODE_H */ /* Grab the keyboard, too */ XGrabKeyboard( @@ -565,7 +600,7 @@ void fgPlatformEnterGameMode( void ) } -void fgPlatformLeaveGameMode( void ) +void fgPlatformLeaveGameMode( void ) { XUngrabPointer( fgDisplay.pDisplay.Display, CurrentTime ); XUngrabKeyboard( fgDisplay.pDisplay.Display, CurrentTime ); From a894e63bdd6e348ccfe387f40a61029e4932378f Mon Sep 17 00:00:00 2001 From: dcnieho Date: Mon, 18 Aug 2014 02:00:40 +0000 Subject: [PATCH 2/2] For builds not using cmake, generate fg_version.h to match cmake-specified version number. git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1696 7f0cb862-5218-0410-a997-914c9d46530a --- freeglut/freeglut/CMakeLists.txt | 2 ++ freeglut/freeglut/config.h.in | 5 --- freeglut/freeglut/src/fg_internal.h | 2 ++ freeglut/freeglut/src/fg_version.h | 47 +++++++++++++++++++++++++++ freeglut/freeglut/src/fg_version.h.in | 47 +++++++++++++++++++++++++++ 5 files changed, 98 insertions(+), 5 deletions(-) create mode 100644 freeglut/freeglut/src/fg_version.h create mode 100644 freeglut/freeglut/src/fg_version.h.in diff --git a/freeglut/freeglut/CMakeLists.txt b/freeglut/freeglut/CMakeLists.txt index d45b9a5..7cd2afc 100644 --- a/freeglut/freeglut/CMakeLists.txt +++ b/freeglut/freeglut/CMakeLists.txt @@ -18,6 +18,8 @@ set(VERSION_MAJOR 3) set(VERSION_MINOR 0) set(VERSION_PATCH 0) +# Update fg_version.h to match the versions number here in cmake +CONFIGURE_FILE(src/fg_version.h.in src/fg_version.h) # FREEGLUT_BUILD_SHARED_LIBS is already a standard CMake variable, but we need to # re-declare it here so it will show up in the GUI. diff --git a/freeglut/freeglut/config.h.in b/freeglut/freeglut/config.h.in index 16c39c3..7da6007 100644 --- a/freeglut/freeglut/config.h.in +++ b/freeglut/freeglut/config.h.in @@ -19,11 +19,6 @@ #cmakedefine HAVE_ULONG_LONG #cmakedefine HAVE_U__INT64 -/* version numbers */ -#define VERSION_MAJOR @VERSION_MAJOR@ -#define VERSION_MINOR @VERSION_MINOR@ -#define VERSION_PATCH @VERSION_PATCH@ - /* warning and errors printed? */ #cmakedefine FREEGLUT_PRINT_WARNINGS #cmakedefine FREEGLUT_PRINT_ERRORS diff --git a/freeglut/freeglut/src/fg_internal.h b/freeglut/freeglut/src/fg_internal.h index 6698865..5e35378 100644 --- a/freeglut/freeglut/src/fg_internal.h +++ b/freeglut/freeglut/src/fg_internal.h @@ -32,6 +32,8 @@ # include "config.h" #endif +#include "fg_version.h" + /* Freeglut is intended to function under all Unix/X11 and Win32 platforms. */ /* XXX: Don't all MS-Windows compilers (except Cygwin) have _WIN32 defined? * XXX: If so, remove the first set of defined()'s below. diff --git a/freeglut/freeglut/src/fg_version.h b/freeglut/freeglut/src/fg_version.h new file mode 100644 index 0000000..20bed2f --- /dev/null +++ b/freeglut/freeglut/src/fg_version.h @@ -0,0 +1,47 @@ +/* + * fg_version.h + * + * The freeglut library private include file. + * + * Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved. + * Written by Pawel W. Olszta, + * Creation date: Thu Dec 2 1999 + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef FREEGLUT_VERSION_H +#define FREEGLUT_VERSION_H + +/* Ordinarily it's cmake's job to update fg_version.h, + * edit CMakeLists.txt rather than this file directly. + */ + +#ifndef VERSION_MAJOR +#define VERSION_MAJOR 3 +#endif + +#ifndef VERSION_MINOR +#define VERSION_MINOR 0 +#endif + +#ifndef VERSION_PATCH +#define VERSION_PATCH 0 +#endif + +#endif diff --git a/freeglut/freeglut/src/fg_version.h.in b/freeglut/freeglut/src/fg_version.h.in new file mode 100644 index 0000000..45b489a --- /dev/null +++ b/freeglut/freeglut/src/fg_version.h.in @@ -0,0 +1,47 @@ +/* + * fg_version.h + * + * The freeglut library private include file. + * + * Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved. + * Written by Pawel W. Olszta, + * Creation date: Thu Dec 2 1999 + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef FREEGLUT_VERSION_H +#define FREEGLUT_VERSION_H + +/* Ordinarily it's cmake's job to update fg_version.h, + * edit CMakeLists.txt rather than this file directly. + */ + +#ifndef VERSION_MAJOR +#define VERSION_MAJOR @VERSION_MAJOR@ +#endif + +#ifndef VERSION_MINOR +#define VERSION_MINOR @VERSION_MINOR@ +#endif + +#ifndef VERSION_PATCH +#define VERSION_PATCH @VERSION_PATCH@ +#endif + +#endif