Fixing bug report 3021598 by modifying "glutSetWindow" under Windows so that it only...
authorJohn F. Fay <johnffay@nettally.com>
Tue, 25 Jan 2011 05:17:12 +0000 (05:17 +0000)
committerJohn F. Fay <johnffay@nettally.com>
Tue, 25 Jan 2011 05:17:12 +0000 (05:17 +0000)
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

index e9da324..3513498 100644 (file)
@@ -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;