win32: prevent modifier keys from getting stuck

Especially Alt would get stuck when using Alt+Tab to change focus.
Apparently Windows doesn't send an appropriate key up message. Solve
this by resetting the modifier state on focus change.
This commit is contained in:
wm4 2012-04-13 17:25:30 +02:00
parent 1d527f0cf2
commit 4dc0e54d4f
1 changed files with 5 additions and 0 deletions

View File

@ -239,6 +239,11 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l
}
break;
}
case WM_SETFOCUS:
case WM_KILLFOCUS:
// prevent modifier keys from getting stuck
memset(key_state, 0, sizeof(key_state));
break;
case WM_LBUTTONDOWN:
if (!vo_nomouse_input && (vo_fs || (wParam & MK_CONTROL))) {
mplayer_put_key(MOUSE_BTN0 | mod_state());