From: John F. Fay Date: Tue, 25 Jan 2011 05:17:12 +0000 (+0000) Subject: Fixing bug report 3021598 by modifying "glutSetWindow" under Windows so that it only... X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=commitdiff_plain;h=ed763e2ce311f7cffc144bd93617c8978b84870c;p=freeglut Fixing bug report 3021598 by modifying "glutSetWindow" under Windows so that it only releases and gets the device context if the window is being set to a new window git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@888 7f0cb862-5218-0410-a997-914c9d46530a --- diff --git a/src/freeglut_window.c b/src/freeglut_window.c index e9da324..3513498 100644 --- a/src/freeglut_window.c +++ b/src/freeglut_window.c @@ -812,17 +812,20 @@ void fgSetWindow ( SFG_Window *window ) ); } #elif TARGET_HOST_MS_WINDOWS - if( fgStructure.CurrentWindow ) - ReleaseDC( fgStructure.CurrentWindow->Window.Handle, - fgStructure.CurrentWindow->Window.Device ); - - if ( window ) + if ( window != fgStructure.CurrentWindow ) { - window->Window.Device = GetDC( window->Window.Handle ); - wglMakeCurrent( - window->Window.Device, - window->Window.Context - ); + if( fgStructure.CurrentWindow ) + ReleaseDC( fgStructure.CurrentWindow->Window.Handle, + fgStructure.CurrentWindow->Window.Device ); + + if ( window ) + { + window->Window.Device = GetDC( window->Window.Handle ); + wglMakeCurrent( + window->Window.Device, + window->Window.Context + ); + } } #endif fgStructure.CurrentWindow = window;