Skip to content

Commit

Permalink
Set lastRect after a successful call to ClipCursor
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaldaien committed Dec 29, 2024
1 parent 3617462 commit 75da515
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions src/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8462,6 +8462,8 @@ BOOL
WINAPI
SK_ClipCursor (const RECT *lpRect)
{
BOOL bRet = TRUE;

// Do not allow cursor clipping when the game's window is inactive
if ((! game_window.active) || (game_window.size_move)) // Or being moved
lpRect = nullptr;
Expand All @@ -8475,26 +8477,29 @@ SK_ClipCursor (const RECT *lpRect)
(nullptr != lpRect &&
memcmp (&lastRect, lpRect, sizeof (RECT)) != 0))
{
if (lpRect == nullptr)
{
lastRect.left = LONG_MIN;
lastRect.top = LONG_MIN;
lastRect.bottom = LONG_MAX;
lastRect.right = LONG_MAX;
}

else
{
lastRect = *lpRect;
}

return
bRet =
ClipCursor_Original != nullptr ?
ClipCursor_Original (lpRect) :
ClipCursor (lpRect);

if (bRet)
{
if (lpRect == nullptr)
{
lastRect.left = LONG_MIN;
lastRect.top = LONG_MIN;
lastRect.bottom = LONG_MAX;
lastRect.right = LONG_MAX;
}

else
{
lastRect = *lpRect;
}
}
}

return TRUE;
return bRet;
}

BOOL
Expand Down

0 comments on commit 75da515

Please sign in to comment.