Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2666)

Unified Diff: ash/accelerators/accelerator_controller.cc

Issue 11419306: Don't disable Caps Lock when Shift+<non-modifier-key> is pressed and Shift is released first. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ash/accelerators/accelerator_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/accelerators/accelerator_controller.cc
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc
index 153cba41ecffcedbd8469b2485bf2716dd40d859..cd62a95656b0968855b635f2d7c1aafebe862092 100644
--- a/ash/accelerators/accelerator_controller.cc
+++ b/ash/accelerators/accelerator_controller.cc
@@ -450,6 +450,8 @@ bool AcceleratorController::PerformAction(int action,
// Type of the previous accelerator. Used by NEXT_IME and DISABLE_CAPS_LOCK.
const ui::EventType previous_event_type =
context_.previous_accelerator().type();
+ const ui::KeyboardCode previous_key_code =
+ context_.previous_accelerator().key_code();
// You *MUST* return true when some action is performed. Otherwise, this
// function might be called *twice*, via BrowserView::PreHandleKeyboardEvent
@@ -539,10 +541,6 @@ bool AcceleratorController::PerformAction(int action,
// For bindings on the Search key, activate the binding on press if the
// Search key is not acting as a modifier. Otherwise, activate it on
// release.
-
- const ui::KeyboardCode previous_key_code =
- context_.previous_accelerator().key_code();
-
const bool search_as_function_key =
Shell::GetInstance()->delegate()->IsSearchKeyActingAsFunctionKey();
const bool type_pressed = accelerator.type() == ui::ET_KEY_PRESSED;
@@ -571,9 +569,12 @@ bool AcceleratorController::PerformAction(int action,
ash::Shell::GetInstance()->ToggleAppList();
return true;
case DISABLE_CAPS_LOCK:
- // See: case NEXT_IME.
- if (previous_event_type == ui::ET_KEY_RELEASED) {
- // We totally ignore this accelerator.
+ if (previous_event_type == ui::ET_KEY_RELEASED ||
+ (previous_key_code != ui::VKEY_LSHIFT &&
+ previous_key_code != ui::VKEY_SHIFT &&
+ previous_key_code != ui::VKEY_RSHIFT)) {
+ // If something else was pressed between the Shift key being pressed
+ // and released, then ignore the release of the Shift key.
return false;
}
if (shell->caps_lock_delegate()->IsCapsLockEnabled()) {
@@ -656,8 +657,8 @@ bool AcceleratorController::PerformAction(int action,
// This workaround allows the user to trigger NEXT_IME even if the
// user presses Shift+Alt before releasing Enter.
// TODO(nona|mazda): Fix crbug.com/139556 in a cleaner way.
- context_.previous_accelerator().key_code() != ui::VKEY_RETURN &&
- context_.previous_accelerator().key_code() != ui::VKEY_SPACE) {
+ previous_key_code != ui::VKEY_RETURN &&
+ previous_key_code != ui::VKEY_SPACE) {
// We totally ignore this accelerator.
// TODO(mazda): Fix crbug.com/158217
return false;
« no previous file with comments | « no previous file | ash/accelerators/accelerator_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698