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

Side by Side Diff: ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc

Issue 1110693002: Revise Control+key restriction for XKB layouts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 757 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 *dom_key = NonPrintableXkbKeySymToDomKey(xkb_keysym); 768 *dom_key = NonPrintableXkbKeySymToDomKey(xkb_keysym);
769 if (*dom_key == DomKey::NONE) { 769 if (*dom_key == DomKey::NONE) {
770 *dom_key = CharacterToDomKey(*character); 770 *dom_key = CharacterToDomKey(*character);
771 *key_code = AlphanumericKeyboardCode(*character); 771 *key_code = AlphanumericKeyboardCode(*character);
772 if (*key_code == VKEY_UNKNOWN) { 772 if (*key_code == VKEY_UNKNOWN) {
773 *key_code = DifficultKeyboardCode(dom_code, flags, xkb_keycode, xkb_flags, 773 *key_code = DifficultKeyboardCode(dom_code, flags, xkb_keycode, xkb_flags,
774 xkb_keysym, *dom_key, *character); 774 xkb_keysym, *dom_key, *character);
775 if (*key_code == VKEY_UNKNOWN) 775 if (*key_code == VKEY_UNKNOWN)
776 *key_code = DomCodeToUsLayoutKeyboardCode(dom_code); 776 *key_code = DomCodeToUsLayoutKeyboardCode(dom_code);
777 } 777 }
778 778 // If the Control key is down, only allow ASCII control characters to be
779 if ((flags & EF_CONTROL_DOWN) == EF_CONTROL_DOWN) { 779 // returned, regardless of the key layout. crbug.com/450849
780 // Use GetCharacterFromKeyCode() to set |character| to 0x0 for keys that 780 if ((flags & EF_CONTROL_DOWN) && (*character >= 0x20))
781 // are not part of the accepted set of Control+Key combinations. 781 *character = 0;
782 *character = GetCharacterFromKeyCode(*key_code, flags);
783 }
784 } else if (*dom_key == DomKey::DEAD) { 782 } else if (*dom_key == DomKey::DEAD) {
785 *character = DeadXkbKeySymToCombiningCharacter(xkb_keysym); 783 *character = DeadXkbKeySymToCombiningCharacter(xkb_keysym);
786 *key_code = DomCodeToUsLayoutKeyboardCode(dom_code); 784 *key_code = DomCodeToUsLayoutKeyboardCode(dom_code);
787 } else { 785 } else {
788 *key_code = NonPrintableDomKeyToKeyboardCode(*dom_key); 786 *key_code = NonPrintableDomKeyToKeyboardCode(*dom_key);
789 if (*key_code == VKEY_UNKNOWN) 787 if (*key_code == VKEY_UNKNOWN)
790 *key_code = DomCodeToUsLayoutKeyboardCode(dom_code); 788 *key_code = DomCodeToUsLayoutKeyboardCode(dom_code);
791 } 789 }
792 return true; 790 return true;
793 } 791 }
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 close_index = layout_name.size(); 955 close_index = layout_name.size();
958 *layout_variant = layout_name.substr(parentheses_index + 1, 956 *layout_variant = layout_name.substr(parentheses_index + 1,
959 close_index - parentheses_index - 1); 957 close_index - parentheses_index - 1);
960 } else if (dash_index != std::string::npos) { 958 } else if (dash_index != std::string::npos) {
961 *layout_id = layout_name.substr(0, dash_index); 959 *layout_id = layout_name.substr(0, dash_index);
962 *layout_variant = layout_name.substr(dash_index + 1); 960 *layout_variant = layout_name.substr(dash_index + 1);
963 } 961 }
964 } 962 }
965 963
966 } // namespace ui 964 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698