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 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 // NOTIMPLEMENTED(); | 743 // NOTIMPLEMENTED(); |
744 return false; | 744 return false; |
745 } | 745 } |
746 | 746 |
747 bool XkbKeyboardLayoutEngine::Lookup(DomCode dom_code, | 747 bool XkbKeyboardLayoutEngine::Lookup(DomCode dom_code, |
748 int flags, | 748 int flags, |
749 DomKey* dom_key, | 749 DomKey* dom_key, |
750 base::char16* character, | 750 base::char16* character, |
751 KeyboardCode* key_code, | 751 KeyboardCode* key_code, |
752 uint32* platform_keycode) const { | 752 uint32* platform_keycode) const { |
| 753 if (dom_code == DomCode::NONE) |
| 754 return false; |
753 // Convert DOM physical key to XKB representation. | 755 // Convert DOM physical key to XKB representation. |
754 xkb_keycode_t xkb_keycode = key_code_converter_.DomCodeToXkbKeyCode(dom_code); | 756 xkb_keycode_t xkb_keycode = key_code_converter_.DomCodeToXkbKeyCode(dom_code); |
755 if (xkb_keycode == key_code_converter_.InvalidXkbKeyCode()) { | 757 if (xkb_keycode == key_code_converter_.InvalidXkbKeyCode()) { |
756 LOG(ERROR) << "No XKB keycode for DomCode 0x" << std::hex | 758 LOG(ERROR) << "No XKB keycode for DomCode 0x" << std::hex |
757 << static_cast<int>(dom_code) << " '" | 759 << static_cast<int>(dom_code) << " '" |
758 << KeycodeConverter::DomCodeToCodeString(dom_code) << "'"; | 760 << KeycodeConverter::DomCodeToCodeString(dom_code) << "'"; |
759 return false; | 761 return false; |
760 } | 762 } |
761 xkb_mod_mask_t xkb_flags = EventFlagsToXkbFlags(flags); | 763 xkb_mod_mask_t xkb_flags = EventFlagsToXkbFlags(flags); |
762 // Obtain keysym and character. | 764 // Obtain keysym and character. |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
956 if (close_index == std::string::npos) | 958 if (close_index == std::string::npos) |
957 close_index = layout_name.size(); | 959 close_index = layout_name.size(); |
958 *layout_variant = layout_name.substr(parentheses_index + 1, | 960 *layout_variant = layout_name.substr(parentheses_index + 1, |
959 close_index - parentheses_index - 1); | 961 close_index - parentheses_index - 1); |
960 } else if (dash_index != std::string::npos) { | 962 } else if (dash_index != std::string::npos) { |
961 *layout_id = layout_name.substr(0, dash_index); | 963 *layout_id = layout_name.substr(0, dash_index); |
962 *layout_variant = layout_name.substr(dash_index + 1); | 964 *layout_variant = layout_name.substr(dash_index + 1); |
963 } | 965 } |
964 } | 966 } |
965 } // namespace ui | 967 } // namespace ui |
OLD | NEW |