Skip to content

Commit

Permalink
only lock cursor if message was removed
Browse files Browse the repository at this point in the history
  • Loading branch information
FunkyFr3sh committed Sep 9, 2024
1 parent 43ccc87 commit 8a6f94a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/winapi_hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ void HandleMessage(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMa
case WM_RBUTTONUP:
case WM_MBUTTONUP:
{
if (!g_config.devmode && !g_mouse_locked)
if (!g_config.devmode && !g_mouse_locked && (wRemoveMsg & PM_REMOVE))
{
InterlockedExchange((LONG*)&g_ddraw.cursor.x, GET_X_LPARAM(lpMsg->lParam));
InterlockedExchange((LONG*)&g_ddraw.cursor.y, GET_Y_LPARAM(lpMsg->lParam));
Expand Down Expand Up @@ -693,7 +693,7 @@ BOOL WINAPI fake_GetMessageA(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wM
BOOL result = real_GetMessageA(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
if (result)
{
HandleMessage(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax, 0);
HandleMessage(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax, PM_REMOVE);
}

return result;
Expand Down

0 comments on commit 8a6f94a

Please sign in to comment.