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 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
723 scoped_ptr<char, base::FreeDeleter> keymap_str) { | 723 scoped_ptr<char, base::FreeDeleter> keymap_str) { |
724 if (keymap_str) { | 724 if (keymap_str) { |
725 xkb_keymap* keymap = xkb_map_new_from_string( | 725 xkb_keymap* keymap = xkb_map_new_from_string( |
726 xkb_context_.get(), keymap_str.get(), XKB_KEYMAP_FORMAT_TEXT_V1, | 726 xkb_context_.get(), keymap_str.get(), XKB_KEYMAP_FORMAT_TEXT_V1, |
727 XKB_KEYMAP_COMPILE_NO_FLAGS); | 727 XKB_KEYMAP_COMPILE_NO_FLAGS); |
728 XkbKeymapEntry entry = {layout_name, keymap}; | 728 XkbKeymapEntry entry = {layout_name, keymap}; |
729 xkb_keymaps_.push_back(entry); | 729 xkb_keymaps_.push_back(entry); |
730 if (layout_name == current_layout_name_) | 730 if (layout_name == current_layout_name_) |
731 SetKeymap(keymap); | 731 SetKeymap(keymap); |
732 } else { | 732 } else { |
733 LOG(ERROR) << "Keymap file failed to load: " << layout_name; | 733 LOG(ERROR) << "Keymap file failed to load: " << layout_name; |
spang
2015/01/28 20:00:10
I think you should put it in here instead.
kpschoedel
2015/01/28 21:22:19
Done.
| |
734 } | 734 } |
735 } | 735 } |
736 | 736 |
737 bool XkbKeyboardLayoutEngine::UsesISOLevel5Shift() const { | 737 bool XkbKeyboardLayoutEngine::UsesISOLevel5Shift() const { |
738 // NOTIMPLEMENTED(); | 738 // NOTIMPLEMENTED(); |
739 return false; | 739 return false; |
740 } | 740 } |
741 | 741 |
742 bool XkbKeyboardLayoutEngine::UsesAltGr() const { | 742 bool XkbKeyboardLayoutEngine::UsesAltGr() const { |
743 // NOTIMPLEMENTED(); | 743 // NOTIMPLEMENTED(); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
836 // NumLock is always on. | 836 // NumLock is always on. |
837 xkb_flags |= num_lock_mod_mask_; | 837 xkb_flags |= num_lock_mod_mask_; |
838 return xkb_flags; | 838 return xkb_flags; |
839 } | 839 } |
840 | 840 |
841 bool XkbKeyboardLayoutEngine::XkbLookup(xkb_keycode_t xkb_keycode, | 841 bool XkbKeyboardLayoutEngine::XkbLookup(xkb_keycode_t xkb_keycode, |
842 xkb_mod_mask_t xkb_flags, | 842 xkb_mod_mask_t xkb_flags, |
843 xkb_keysym_t* xkb_keysym, | 843 xkb_keysym_t* xkb_keysym, |
844 base::char16* character) const { | 844 base::char16* character) const { |
845 if (!xkb_state_) { | 845 if (!xkb_state_) { |
846 LOG(ERROR) << "No current XKB state"; | 846 LOG(FATAL) << "No current XKB state"; |
847 return false; | 847 return false; |
848 } | 848 } |
849 xkb_state_update_mask(xkb_state_.get(), xkb_flags, 0, 0, 0, 0, 0); | 849 xkb_state_update_mask(xkb_state_.get(), xkb_flags, 0, 0, 0, 0, 0); |
850 *xkb_keysym = xkb_state_key_get_one_sym(xkb_state_.get(), xkb_keycode); | 850 *xkb_keysym = xkb_state_key_get_one_sym(xkb_state_.get(), xkb_keycode); |
851 if (*xkb_keysym == XKB_KEY_NoSymbol) | 851 if (*xkb_keysym == XKB_KEY_NoSymbol) |
852 return false; | 852 return false; |
853 uint32_t c = xkb_state_key_get_utf32(xkb_state_.get(), xkb_keycode); | 853 uint32_t c = xkb_state_key_get_utf32(xkb_state_.get(), xkb_keycode); |
854 DLOG_IF(ERROR, c != (c & 0xFFFF)) << "Non-BMP character:" << c; | 854 DLOG_IF(ERROR, c != (c & 0xFFFF)) << "Non-BMP character:" << c; |
855 *character = static_cast<base::char16>(c); | 855 *character = static_cast<base::char16>(c); |
856 return true; | 856 return true; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
956 if (close_index == std::string::npos) | 956 if (close_index == std::string::npos) |
957 close_index = layout_name.size(); | 957 close_index = layout_name.size(); |
958 *layout_variant = layout_name.substr(parentheses_index + 1, | 958 *layout_variant = layout_name.substr(parentheses_index + 1, |
959 close_index - parentheses_index - 1); | 959 close_index - parentheses_index - 1); |
960 } else if (dash_index != std::string::npos) { | 960 } else if (dash_index != std::string::npos) { |
961 *layout_id = layout_name.substr(0, dash_index); | 961 *layout_id = layout_name.substr(0, dash_index); |
962 *layout_variant = layout_name.substr(dash_index + 1); | 962 *layout_variant = layout_name.substr(dash_index + 1); |
963 } | 963 } |
964 } | 964 } |
965 } // namespace ui | 965 } // namespace ui |
OLD | NEW |