[Engine] Fix mouse locking issues when the mouse would lock at the center of your screen

[Engine] Fix mouse locking issues when the mouse would lock at the center of your screen

diff --git a/src/engine/GPURenderer/r_glimp.cpp b/src/engine/GPURenderer/r_glimp.cpp
index 0e3b9a7..5617c27 100644
--- a/src/engine/GPURenderer/r_glimp.cpp
+++ b/src/engine/GPURenderer/r_glimp.cpp
@@ -832,6 +832,9 @@ static sint GLimp_SetMode( sint mode, bool fullscreen, bool noborder, bool fixed
     glstring = ( valueType* )qglGetString( GL_RENDERER );
     CL_RefPrintf( PRINT_ALL, "GL_RENDERER: %s\n", glstring );
     
+    SDL_MinimizeWindow( SDL_window );
+    SDL_RestoreWindow( SDL_window );
+    
     return RSERR_OK;
 }
 
diff --git a/src/engine/platform/systemInput.cpp b/src/engine/platform/systemInput.cpp
index ec6a10d..1d8866f 100644
--- a/src/engine/platform/systemInput.cpp
+++ b/src/engine/platform/systemInput.cpp
@@ -486,11 +486,19 @@ idSystemLocal::ActivateMouse
 */
 void idSystemLocal::ActivateMouse( void )
 {
+    static connstate_t lastState = CA_UNINITIALIZED;
+    
     if( !mouseAvailable || !SDL_WasInit( SDL_INIT_VIDEO ) )
     {
         return;
     }
     
+    if( cls.state != lastState )
+    {
+        lastState = cls.state;
+        return;
+    }
+    
     if( !mouseActive )
     {
         SDL_SetRelativeMouseMode( SDL_TRUE );

GitHub
sha: 8b646508