From c5b343fbd61bdd4946f2e076e9f37223975a66ee Mon Sep 17 00:00:00 2001 From: "John F. Fay" Date: Sun, 5 Feb 2012 13:53:00 +0000 Subject: [PATCH] Moving an X11-specific function call to destroy a context to the X11-specific file git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1064 7f0cb862-5218-0410-a997-914c9d46530a --- src/Common/freeglut_init.c | 6 ++---- src/mswin/freeglut_init_mswin.c | 5 ++++- src/x11/freeglut_init_x11.c | 6 ++++++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/Common/freeglut_init.c b/src/Common/freeglut_init.c index 1af391e..d8e87e0 100644 --- a/src/Common/freeglut_init.c +++ b/src/Common/freeglut_init.c @@ -99,6 +99,7 @@ SFG_State fgState = { { -1, -1, GL_FALSE }, /* Position */ extern void fgPlatformInitialize( const char* displayName ); extern void fgPlatformDeinitialiseInputDevices ( void ); extern void fgPlatformCloseDisplay ( void ); +extern void fgPlatformDestroyContext ( SFG_PlatformDisplay pDisplay, SFG_WindowContextType MContext ); void fghParseCommandLineArguments ( int* pargc, char** argv, char **pDisplayName, char **pGeometry ) @@ -234,10 +235,7 @@ void fgDeinitialize( void ) /* If there was a menu created, destroy the rendering context */ if( fgStructure.MenuContext ) { -#if TARGET_HOST_POSIX_X11 - /* Note that the MVisualInfo is not owned by the MenuContext! */ - glXDestroyContext( fgDisplay.pDisplay.Display, fgStructure.MenuContext->MContext ); -#endif + fgPlatformDestroyContext (fgDisplay.pDisplay, fgStructure.MenuContext->MContext ); free( fgStructure.MenuContext ); fgStructure.MenuContext = NULL; } diff --git a/src/mswin/freeglut_init_mswin.c b/src/mswin/freeglut_init_mswin.c index d5c94e5..c7457de 100644 --- a/src/mswin/freeglut_init_mswin.c +++ b/src/mswin/freeglut_init_mswin.c @@ -158,7 +158,10 @@ void fgPlatformCloseDisplay ( void ) timeEndPeriod ( 1 ); } - +void fgPlatformDestroyContext ( SFG_PlatformDisplay pDisplay, SFG_WindowContextType MContext ) +{ + /* Do nothing -- this is required for X11 */ +} /* * Everything down to the end of the next two functions is copied from the X sources. diff --git a/src/x11/freeglut_init_x11.c b/src/x11/freeglut_init_x11.c index 8574ce1..3010943 100644 --- a/src/x11/freeglut_init_x11.c +++ b/src/x11/freeglut_init_x11.c @@ -265,3 +265,9 @@ void fgPlatformCloseDisplay ( void ) XCloseDisplay( fgDisplay.pDisplay.Display ); } + +void fgPlatformDestroyContext ( SFG_PlatformDisplay pDisplay, SFG_WindowContextType MContext ) +{ + /* Note that the MVisualInfo is not owned by the MenuContext! */ + glXDestroyContext( pDisplay.Display, MContext ); +} \ No newline at end of file -- 1.7.10.4