Skip to content

Commit

Permalink
fix mouse cursor randomly becoming invisible outside gzdoom
Browse files Browse the repository at this point in the history
  • Loading branch information
RicardoLuis0 committed Apr 10, 2024
1 parent 6777423 commit e8baace
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/common/platform/win32/i_input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,8 @@ bool CallHook(FInputDevice *device, HWND hWnd, UINT message, WPARAM wParam, LPAR
return device->WndProcHook(hWnd, message, wParam, lParam, result);
}

extern void SetCursorState(bool visible);

LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
LRESULT result;
Expand Down Expand Up @@ -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);
return TRUE; // Prevent Windows from setting cursor to window class cursor
}
else
Expand Down
4 changes: 2 additions & 2 deletions src/common/platform/win32/i_mouse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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())
Expand Down

0 comments on commit e8baace

Please sign in to comment.