From: simon Date: Wed, 21 Jan 2009 18:47:03 +0000 (+0000) Subject: Don't call ReleaseCapture() on any mouse-button-up event. Instead, X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/commitdiff_plain/472f9eae6ae8fd07a9c234095afe385a5ac6f198 Don't call ReleaseCapture() on any mouse-button-up event. Instead, only call it when the _last_ mouse button comes back up. Otherwise, xterm mouse tracking will lose a button-up event if you press down two buttons, move the mouse outside the window, then release them one at a time. git-svn-id: svn://svn.tartarus.org/sgt/putty@8425 cda61777-01e9-0310-a592-d414129be87e --- diff --git a/windows/window.c b/windows/window.c index b2dd5e60..416be3fd 100644 --- a/windows/window.c +++ b/windows/window.c @@ -2335,26 +2335,32 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, switch (message) { case WM_LBUTTONDOWN: button = MBT_LEFT; + wParam |= MK_LBUTTON; press = 1; break; case WM_MBUTTONDOWN: button = MBT_MIDDLE; + wParam |= MK_MBUTTON; press = 1; break; case WM_RBUTTONDOWN: button = MBT_RIGHT; + wParam |= MK_RBUTTON; press = 1; break; case WM_LBUTTONUP: button = MBT_LEFT; + wParam &= ~MK_LBUTTON; press = 0; break; case WM_MBUTTONUP: button = MBT_MIDDLE; + wParam &= ~MK_MBUTTON; press = 0; break; case WM_RBUTTONUP: button = MBT_RIGHT; + wParam &= ~MK_RBUTTON; press = 0; break; default: @@ -2413,7 +2419,8 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, TO_CHR_X(X_POS(lParam)), TO_CHR_Y(Y_POS(lParam)), wParam & MK_SHIFT, wParam & MK_CONTROL, is_alt_pressed()); - ReleaseCapture(); + if (!(wParam & (MK_LBUTTON | MK_MBUTTON | MK_RBUTTON))) + ReleaseCapture(); } } return 0;