From 4dc0e54d4fffa2b81fbf6fb9b875303638eb1c9a Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 13 Apr 2012 17:25:30 +0200 Subject: 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. --- libvo/w32_common.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'libvo') diff --git a/libvo/w32_common.c b/libvo/w32_common.c index ff9e2dd505..513cf2820c 100644 --- a/libvo/w32_common.c +++ b/libvo/w32_common.c @@ -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()); -- cgit v1.2.3