fix reset relative mouse state inconsistency

This commit is contained in:
Roman Fomin 2024-02-11 21:02:08 +07:00
parent 6d3c3930ff
commit c42ec4e63e
3 changed files with 8 additions and 11 deletions

View File

@ -154,7 +154,6 @@ static void SetShowCursor(boolean show)
// When the cursor is hidden, grab the input.
// Relative mode implicitly hides the cursor.
SDL_SetRelativeMouseMode(!show);
SDL_GetRelativeMouseState(NULL, NULL);
}
//
@ -177,7 +176,6 @@ static void UpdateGrab(void)
if (!grab && currently_grabbed)
{
SetShowCursor(true);
SDL_GetRelativeMouseState(NULL, NULL);
}
currently_grabbed = grab;
@ -196,15 +194,12 @@ void I_ShowMouseCursor(boolean on)
state = on;
}
if (on)
{
SDL_ShowCursor(SDL_ENABLE);
}
else
{
SDL_ShowCursor(SDL_DISABLE);
SDL_ShowCursor(on);
}
void I_ResetRelativeMouseState(void)
{
SDL_GetRelativeMouseState(NULL, NULL);
}
}
// [FG] window event handling from Chocolate Doom 3.0

View File

@ -108,6 +108,7 @@ void *I_GetSDLRenderer(void);
void I_InitWindowIcon(void);
void I_ShowMouseCursor(boolean on);
void I_ResetRelativeMouseState(void);
#endif

View File

@ -6770,6 +6770,7 @@ static void M_ClearMenus(void)
// sendpause = true;
G_ClearInput();
I_ResetRelativeMouseState();
}
//