From ed763e2ce311f7cffc144bd93617c8978b84870c Mon Sep 17 00:00:00 2001 From: "John F. Fay" Date: Tue, 25 Jan 2011 05:17:12 +0000 Subject: [PATCH] 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 --- src/freeglut_window.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) 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; -- 1.7.10.4