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 "ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.h" | 5 #include "ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.h" |
6 | 6 |
7 #include <xkbcommon/xkbcommon-names.h> | 7 #include <xkbcommon/xkbcommon-names.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
781 *dom_key = NonPrintableXkbKeySymToDomKey(xkb_keysym); | 781 *dom_key = NonPrintableXkbKeySymToDomKey(xkb_keysym); |
782 if (*dom_key == DomKey::NONE) { | 782 if (*dom_key == DomKey::NONE) { |
783 *dom_key = CharacterToDomKey(*character); | 783 *dom_key = CharacterToDomKey(*character); |
784 *key_code = AlphanumericKeyboardCode(*character); | 784 *key_code = AlphanumericKeyboardCode(*character); |
785 if (*key_code == VKEY_UNKNOWN) { | 785 if (*key_code == VKEY_UNKNOWN) { |
786 *key_code = DifficultKeyboardCode(dom_code, flags, xkb_keycode, xkb_flags, | 786 *key_code = DifficultKeyboardCode(dom_code, flags, xkb_keycode, xkb_flags, |
787 xkb_keysym, *dom_key, *character); | 787 xkb_keysym, *dom_key, *character); |
788 if (*key_code == VKEY_UNKNOWN) | 788 if (*key_code == VKEY_UNKNOWN) |
789 *key_code = DomCodeToUsLayoutKeyboardCode(dom_code); | 789 *key_code = DomCodeToUsLayoutKeyboardCode(dom_code); |
790 } | 790 } |
791 | 791 // If the Control key is down, only allow C0 characters to be returned, |
Wez
2015/04/21 22:08:46
C0 characters..?
kpschoedel
2015/04/21 22:36:38
Standardese for ASCII control characters. Changed
| |
792 if ((flags & EF_CONTROL_DOWN) == EF_CONTROL_DOWN) { | 792 // regardless of the key layout. crbug.com/450849 |
793 // Use GetCharacterFromKeyCode() to set |character| to 0x0 for keys that | 793 if ((flags & EF_CONTROL_DOWN) && (*character >= 0x20)) |
794 // are not part of the accepted set of Control+Key combinations. | 794 *character = 0; |
795 *character = GetCharacterFromKeyCode(*key_code, flags); | |
796 } | |
797 } else if (*dom_key == DomKey::DEAD) { | 795 } else if (*dom_key == DomKey::DEAD) { |
798 *character = DeadXkbKeySymToCombiningCharacter(xkb_keysym); | 796 *character = DeadXkbKeySymToCombiningCharacter(xkb_keysym); |
799 *key_code = DomCodeToUsLayoutKeyboardCode(dom_code); | 797 *key_code = DomCodeToUsLayoutKeyboardCode(dom_code); |
800 } else { | 798 } else { |
801 *key_code = NonPrintableDomKeyToKeyboardCode(*dom_key); | 799 *key_code = NonPrintableDomKeyToKeyboardCode(*dom_key); |
802 if (*key_code == VKEY_UNKNOWN) | 800 if (*key_code == VKEY_UNKNOWN) |
803 *key_code = DomCodeToUsLayoutKeyboardCode(dom_code); | 801 *key_code = DomCodeToUsLayoutKeyboardCode(dom_code); |
804 } | 802 } |
805 return true; | 803 return true; |
806 } | 804 } |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
969 if (close_index == std::string::npos) | 967 if (close_index == std::string::npos) |
970 close_index = layout_name.size(); | 968 close_index = layout_name.size(); |
971 *layout_variant = layout_name.substr(parentheses_index + 1, | 969 *layout_variant = layout_name.substr(parentheses_index + 1, |
972 close_index - parentheses_index - 1); | 970 close_index - parentheses_index - 1); |
973 } else if (dash_index != std::string::npos) { | 971 } else if (dash_index != std::string::npos) { |
974 *layout_id = layout_name.substr(0, dash_index); | 972 *layout_id = layout_name.substr(0, dash_index); |
975 *layout_variant = layout_name.substr(dash_index + 1); | 973 *layout_variant = layout_name.substr(dash_index + 1); |
976 } | 974 } |
977 } | 975 } |
978 } // namespace ui | 976 } // namespace ui |
OLD | NEW |