fix mouse cursor randomly becoming invisible outside gzdoom

This commit is contained in:
Ricardo Luís Vaz Silva 2024-04-10 15:13:17 -03:00 committed by Christoph Oelckers
parent 6777423d23
commit 97effb9047
2 changed files with 5 additions and 3 deletions

View file

@ -110,6 +110,8 @@ EXTERN_CVAR (Bool, use_mouse)
static int WheelDelta;
extern bool CursorState;
void SetCursorState(bool visible);
extern BOOL paused;
static bool noidle = false;
@ -415,7 +417,7 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_SETCURSOR:
if (!CursorState)
{
SetCursor(NULL); // turn off window cursor
SetCursorState(false); // turn off window cursor
return TRUE; // Prevent Windows from setting cursor to window class cursor
}
else

View file

@ -131,7 +131,7 @@ enum EMouseMode
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
static void SetCursorState(bool visible);
void SetCursorState(bool visible);
static FMouse *CreateWin32Mouse();
static FMouse *CreateDInputMouse();
static FMouse *CreateRawMouse();
@ -191,7 +191,7 @@ CUSTOM_CVAR (Int, in_mouse, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL)
static bool mouse_shown = true;
static void SetCursorState(bool visible)
void SetCursorState(bool visible)
{
CursorState = visible || !m_hidepointer;
if (GetForegroundWindow() == mainwindow.GetHandle())