OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/chromeos/events/event_rewriter.h" | 5 #include "chrome/browser/chromeos/events/event_rewriter.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/sticky_keys/sticky_keys_controller.h" | 9 #include "ash/sticky_keys/sticky_keys_controller.h" |
10 #include "ash/wm/window_state.h" | 10 #include "ash/wm/window_state.h" |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 } | 682 } |
683 | 683 |
684 // Next, remap modifier bits. | 684 // Next, remap modifier bits. |
685 state->flags |= | 685 state->flags |= |
686 GetRemappedModifierMasks(*pref_service, key_event, incoming.flags); | 686 GetRemappedModifierMasks(*pref_service, key_event, incoming.flags); |
687 if (key_event.type() == ui::ET_KEY_PRESSED) | 687 if (key_event.type() == ui::ET_KEY_PRESSED) |
688 state->flags |= characteristic_flag; | 688 state->flags |= characteristic_flag; |
689 else | 689 else |
690 state->flags &= ~characteristic_flag; | 690 state->flags &= ~characteristic_flag; |
691 | 691 |
692 // Toggle Caps Lock if the remapped key is ui::VKEY_CAPITAL, but do nothing if | 692 // Toggle Caps Lock if the remapped key is ui::VKEY_CAPITAL. |
693 // the original key is ui::VKEY_CAPITAL (i.e. a Caps Lock key on an external | |
694 // keyboard is pressed) since X can handle that case. | |
695 if (key_event.type() == ui::ET_KEY_PRESSED && | 693 if (key_event.type() == ui::ET_KEY_PRESSED && |
| 694 #if defined(USE_X11) |
| 695 // ... but for X11, do nothing if the original key is ui::VKEY_CAPITAL |
| 696 // (i.e. a Caps Lock key on an external keyboard is pressed) since X |
| 697 // handles that itself. |
696 incoming.key_code != ui::VKEY_CAPITAL && | 698 incoming.key_code != ui::VKEY_CAPITAL && |
| 699 #endif |
697 state->key_code == ui::VKEY_CAPITAL) { | 700 state->key_code == ui::VKEY_CAPITAL) { |
698 chromeos::input_method::ImeKeyboard* ime_keyboard = | 701 chromeos::input_method::ImeKeyboard* ime_keyboard = |
699 ime_keyboard_for_testing_ | 702 ime_keyboard_for_testing_ |
700 ? ime_keyboard_for_testing_ | 703 ? ime_keyboard_for_testing_ |
701 : chromeos::input_method::InputMethodManager::Get() | 704 : chromeos::input_method::InputMethodManager::Get() |
702 ->GetImeKeyboard(); | 705 ->GetImeKeyboard(); |
703 ime_keyboard->SetCapsLockEnabled(!ime_keyboard->CapsLockIsEnabled()); | 706 ime_keyboard->SetCapsLockEnabled(!ime_keyboard->CapsLockIsEnabled()); |
704 } | 707 } |
705 } | 708 } |
706 | 709 |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 // TODO(spang): Figure out where we can get keyboard vendor/product id from in | 999 // TODO(spang): Figure out where we can get keyboard vendor/product id from in |
997 // Ozone/Freon version. | 1000 // Ozone/Freon version. |
998 return KeyboardDeviceAddedInternal(device_id, | 1001 return KeyboardDeviceAddedInternal(device_id, |
999 "keyboard", | 1002 "keyboard", |
1000 kUnknownVendorId, | 1003 kUnknownVendorId, |
1001 kUnknownProductId); | 1004 kUnknownProductId); |
1002 #endif | 1005 #endif |
1003 } | 1006 } |
1004 | 1007 |
1005 } // namespace chromeos | 1008 } // namespace chromeos |
OLD | NEW |