No cursor lock when window inactive (#5754)
authorSmallJoker <SmallJoker@users.noreply.github.com>
Sat, 13 May 2017 15:42:42 +0000 (17:42 +0200)
committerGitHub <noreply@github.com>
Sat, 13 May 2017 15:42:42 +0000 (17:42 +0200)
src/game.cpp

index f237a87aad09ba85bc5e13942b65696f868a9d32..f079f836b9e611105323194584f1c2a0842a0f17 100644 (file)
@@ -2956,7 +2956,8 @@ void Game::toggleFullViewRange()
 
 void Game::updateCameraDirection(CameraOrientation *cam, float dtime)
 {
-       if ((device->isWindowActive() && !isMenuActive()) || random_input) {
+       if ((device->isWindowActive() && device->isWindowFocused()
+                       && !isMenuActive()) || random_input) {
 
 #ifndef __ANDROID__
                if (!random_input) {
@@ -2981,8 +2982,7 @@ void Game::updateCameraDirection(CameraOrientation *cam, float dtime)
                        device->getCursorControl()->setVisible(true);
 #endif
 
-               if (!m_first_loop_after_window_activation)
-                       m_first_loop_after_window_activation = true;
+               m_first_loop_after_window_activation = true;
 
        }
 }