From 33bfdcd50dfc47eefb45950ce0d00fdff5b03f7e Mon Sep 17 00:00:00 2001 From: "hbono@chromium.org" Date: Fri, 24 Sep 2010 07:19:48 +0000 Subject: A quick fix for Issue 45091. This change checks the states of ctrl and shift keys when proceesing acclerators to prevent FocusManager from consuming ctrl+alt keys and shift+alt keys. Windows sends SC_KEYMENU commands not only when we type only an alt key but also when we type ctrl+alt keys and shift+alt keys, both are used for changing input languages and keyboard layouts. To prevent these keys from being accidentally consumed by FocusManager, we check the states of these keys and send them to FocusManager. BUG=45091 TEST=interactive_ui_tests.exe --gtest_filter=KeyboardAccessTest.TestShiftAltMenuKeyboardAccess. Review URL: http://codereview.chromium.org/3318022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60433 0039d316-1c4b-4281-b951-d872f2087c98 --- views/window/window_win.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'views/window') diff --git a/views/window/window_win.cc b/views/window/window_win.cc index 6aa5224..c81fe27 100644 --- a/views/window/window_win.cc +++ b/views/window/window_win.cc @@ -1121,8 +1121,12 @@ void WindowWin::OnSysCommand(UINT notification_code, CPoint click) { // Handle SC_KEYMENU, which means that the user has pressed the ALT // key and released it, so we should focus the menu bar. if ((notification_code & sc_mask) == SC_KEYMENU && click.x == 0) { + // Retrieve the status of shift and control keys to prevent consuming + // shift+alt keys, which are used by Windows to change input languages. Accelerator accelerator(app::KeyboardCodeForWindowsKeyCode(VK_MENU), - false, false, false); + !!(GetKeyState(VK_SHIFT) & 0x8000), + !!(GetKeyState(VK_CONTROL) & 0x8000), + false); GetFocusManager()->ProcessAccelerator(accelerator); return; } -- cgit v1.1