diff options
author | wm4 <wm4@mplayer2.org> | 2012-04-13 17:25:30 +0200 |
---|---|---|
committer | wm4 <wm4@mplayer2.org> | 2012-04-13 17:27:18 +0200 |
commit | 4dc0e54d4fffa2b81fbf6fb9b875303638eb1c9a (patch) | |
tree | 71727e645089d9441c460851a15099ee6400ccf3 /libvo | |
parent | 1d527f0cf25ff51021a6042079cc51b64569585a (diff) | |
download | mpv-4dc0e54d4fffa2b81fbf6fb9b875303638eb1c9a.tar.bz2 mpv-4dc0e54d4fffa2b81fbf6fb9b875303638eb1c9a.tar.xz |
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.
Diffstat (limited to 'libvo')
-rw-r--r-- | libvo/w32_common.c | 5 |
1 files changed, 5 insertions, 0 deletions
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()); |