Prechádzať zdrojové kódy

Hack fix for window always getting maximized after fullscreen -> windowed change on D3D9 & D3D11.

Lasse Öörni 9 rokov pred
rodič
commit
2203cd41a6

+ 3 - 0
Source/Urho3D/Graphics/Direct3D11/D3D11Graphics.cpp

@@ -2199,8 +2199,11 @@ void Graphics::AdjustWindow(int& newWidth, int& newHeight, bool& newFullscreen,
         else
             SDL_SetWindowSize(impl_->window_, newWidth, newHeight);
 
+        // Hack fix: on SDL 2.0.4 a fullscreen->windowed transition results in a maximized window when the D3D device is reset, so hide before
+        SDL_HideWindow(impl_->window_);
         SDL_SetWindowFullscreen(impl_->window_, newFullscreen ? SDL_TRUE : SDL_FALSE);
         SDL_SetWindowBordered(impl_->window_, newBorderless ? SDL_FALSE : SDL_TRUE);
+        SDL_ShowWindow(impl_->window_);
     }
     else
     {

+ 3 - 0
Source/Urho3D/Graphics/Direct3D9/D3D9Graphics.cpp

@@ -2421,8 +2421,11 @@ void Graphics::AdjustWindow(int& newWidth, int& newHeight, bool& newFullscreen,
         else
             SDL_SetWindowSize(impl_->window_, newWidth, newHeight);
 
+        // Hack fix: on SDL 2.0.4 a fullscreen->windowed transition results in a maximized window when the D3D device is reset, so hide before
+        SDL_HideWindow(impl_->window_);
         SDL_SetWindowFullscreen(impl_->window_, newFullscreen ? SDL_TRUE : SDL_FALSE);
         SDL_SetWindowBordered(impl_->window_, newBorderless ? SDL_FALSE : SDL_TRUE);
+        SDL_ShowWindow(impl_->window_);
     }
     else
     {