Skip to content

Commit

Permalink
Fix for 500ms hang after user clicks on the title bar, but before mov…
Browse files Browse the repository at this point in the history
  • Loading branch information
ClintKilmer authored Feb 8, 2025
1 parent a0b6c0f commit 69d2802
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/video/windows/SDL_windowsevents.c
Original file line number Diff line number Diff line change
Expand Up @@ -1525,6 +1525,15 @@ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
case WM_NCLBUTTONDOWN:
{
data->in_title_click = true;

// Fix for 500ms hang after user clicks on the title bar, but before moving mouse
// Reference: https://gamedev.net/forums/topic/672094-keeping-things-moving-during-win32-moveresize-events/5254386/
if (SendMessage(hwnd, WM_NCHITTEST, wParam, lParam) == HTCAPTION) {
POINT cursorPos;
GetCursorPos(&cursorPos);
ScreenToClient(hwnd, &cursorPos);
PostMessage(hwnd, WM_MOUSEMOVE, 0, cursorPos.x | cursorPos.y << 16);
}
} break;

case WM_CAPTURECHANGED:
Expand Down

0 comments on commit 69d2802

Please sign in to comment.