From 430b22d5d7f132d6679e0353836b4c7386c62ad5 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Sat, 4 May 2024 17:37:32 -0500 Subject: [PATCH] Dont unfocus game window while cursor is not visible unless the lock mode is none. --- Source/Editor/Windows/GameWindow.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/Editor/Windows/GameWindow.cs b/Source/Editor/Windows/GameWindow.cs index fe0c79084..349301ec9 100644 --- a/Source/Editor/Windows/GameWindow.cs +++ b/Source/Editor/Windows/GameWindow.cs @@ -470,6 +470,10 @@ namespace FlaxEditor.Windows IsMaximized = false; IsBorderless = false; Cursor = CursorType.Default; + Screen.CursorLock = CursorLockMode.None; + if (Screen.MainWindow.IsMouseTracking) + Screen.MainWindow.EndTrackingMouse(); + RootControl.GameRoot.EndMouseCapture(); } /// @@ -478,7 +482,7 @@ namespace FlaxEditor.Windows base.OnMouseLeave(); // Remove focus from game window when mouse moves out and the cursor is hidden during game - if ((IsFocused || ContainsFocus) && Parent != null && Editor.IsPlayMode && !Screen.CursorVisible) + if (ContainsFocus && Parent != null && Editor.IsPlayMode && !Screen.CursorVisible && Screen.CursorLock == CursorLockMode.None) { Parent.Focus(); }