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]
This commit is contained in:
Simon Tatham 2009-01-21 18:47:03 +00:00
Родитель 464aa76aaf
Коммит 9b2515f97e
1 изменённых файлов: 8 добавлений и 1 удалений

Просмотреть файл

@ -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;