Call Window_DisableRawMouse on all platforms when game is closed, not just webclient (Thanks Igor1_)

Fixes on Windows where if cursor grabbing was enabled and the game window was closed via taskbar preview, the cursor would still be trapped/confined in the region the game window was in before the game was closed
This commit is contained in:
UnknownShadow200 2022-02-12 23:44:16 +11:00
parent a966f4b11b
commit fc10386ff9
4 changed files with 3 additions and 1 deletions

View File

@ -624,6 +624,7 @@ void Game_Free(void* obj) {
Logger_WarnFunc = Logger_DialogWarn;
Gfx_Free();
Options_SaveIfChanged();
Window_DisableRawMouse();
}
#define Game_DoFrameBody() \

View File

@ -497,6 +497,7 @@ static void DoCreateWindow(int width, int height) {
Window_CommonCreate();
WindowInfo.Exists = true;
WindowInfo.Handle = win_handle;
/* CGAssociateMouseAndMouseCursorPosition implicitly grabs cursor */
conn = _CGSDefaultConnection();
winId = GetNativeWindowFromWindowRef(win_handle);

View File

@ -496,7 +496,6 @@ void Window_Close(void) {
Window_ExitFullscreen();
/* Don't want cursor stuck on the dead 0,0 canvas */
Window_DisableRawMouse();
Window_SetSize(0, 0);
UnhookEvents();
/* Game_DoFrame doesn't do anything when WindowExists.False is false, */

View File

@ -283,6 +283,7 @@ static void DoCreateWindow(int width, int height) {
Window_CommonCreate();
WindowInfo.Exists = true;
WindowInfo.Handle = winHandle;
// CGAssociateMouseAndMouseCursorPosition implicitly grabs cursor
del = [CCWindowDelegate alloc];
[winHandle setDelegate:del];