Browse Source

Before closing an OpenGL SDL window, set it to windowed to fix annoying transition effect on OS X.

Lasse Öörni 12 years ago
parent
commit
e903c5edff

+ 1 - 0
Source/Engine/Graphics/OpenGL/OGLGraphics.cpp

@@ -2088,6 +2088,7 @@ void Graphics::Release(bool clearGPUObjects, bool closeWindow)
         // Do not destroy external window except when shutting down
         // Do not destroy external window except when shutting down
         if (!externalWindow_ || clearGPUObjects)
         if (!externalWindow_ || clearGPUObjects)
         {
         {
+            SDL_SetWindowFullscreen(impl_->window_, SDL_FALSE);
             SDL_DestroyWindow(impl_->window_);
             SDL_DestroyWindow(impl_->window_);
             impl_->window_ = 0;
             impl_->window_ = 0;
         }
         }

+ 9 - 10
Source/ThirdParty/SDL/src/video/SDL_video.c

@@ -1927,16 +1927,6 @@ SDL_DestroyWindow(SDL_Window * window)
 
 
     CHECK_WINDOW_MAGIC(window, );
     CHECK_WINDOW_MAGIC(window, );
 
 
-#if !SDL_VIDEO_OPENGL_ES && !SDL_VIDEO_OPENGL_ES2
-    // Urho3D: make context uncurrent first
-    /* make no context current if this is the current context window. */
-    if (window->flags & SDL_WINDOW_OPENGL) {
-        if (_this->current_glwin == window) {
-            SDL_GL_MakeCurrent(window, NULL);
-        }
-    }
-#endif
-
     /* Restore video mode, etc. */
     /* Restore video mode, etc. */
     SDL_HideWindow(window);
     SDL_HideWindow(window);
 
 
@@ -1948,6 +1938,15 @@ SDL_DestroyWindow(SDL_Window * window)
         SDL_SetMouseFocus(NULL);
         SDL_SetMouseFocus(NULL);
     }
     }
 
 
+#if !SDL_VIDEO_OPENGL_ES && !SDL_VIDEO_OPENGL_ES2
+    /* make no context current if this is the current context window. */
+    if (window->flags & SDL_WINDOW_OPENGL) {
+        if (_this->current_glwin == window) {
+            SDL_GL_MakeCurrent(window, NULL);
+        }
+    }
+#endif
+    
     if (window->surface) {
     if (window->surface) {
         window->surface->flags &= ~SDL_DONTFREE;
         window->surface->flags &= ~SDL_DONTFREE;
         SDL_FreeSurface(window->surface);
         SDL_FreeSurface(window->surface);