From 9bb7065f74f956fe0eb05320300f9b5bfb13a640 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Thu, 12 Mar 2020 18:38:32 +1100 Subject: [PATCH] Fix on windows, if you release a mouse button outside the window (without switching focus to another window), it stays stuck in-game --- src/Window.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Window.c b/src/Window.c index 013435c42..f6efe46b5 100644 --- a/src/Window.c +++ b/src/Window.c @@ -533,6 +533,11 @@ static LRESULT CALLBACK Window_Procedure(HWND handle, UINT message, WPARAM wPara break; case WM_MOUSEMOVE: + /* Set before position change, in case mouse buttons changed when outside window */ + Input_SetPressed(KEY_LMOUSE, (wParam & 0x01) != 0); + Input_SetPressed(KEY_RMOUSE, (wParam & 0x02) != 0); + Input_SetPressed(KEY_MMOUSE, (wParam & 0x10) != 0); + /* TODO: do we need to set XBUTTON1/XBUTTON2 here */ Pointer_SetPosition(0, LOWORD(lParam), HIWORD(lParam)); break;