From 9b2515f97ec2353480d2f1a9cb8d404eeeae1d80 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Wed, 21 Jan 2009 18:47:03 +0000 Subject: [PATCH] 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. [originally from svn r8425] --- windows/window.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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; -- 2.45.2