X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Ffreeglut_window.c;h=35134986244259edc5e20d3531593930ce3b13c8;hb=ed763e2ce311f7cffc144bd93617c8978b84870c;hp=e9da324a83f461c3871032b1a3baf4f51bc9f0cc;hpb=bd13ff3040ea5d30009892eecc31854ed11ac408;p=freeglut 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;