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

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

Issue 1312833006: Remove ui::KeyEvent::platform_keycode_ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 3 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
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 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 } 708 }
709 709
710 bool XkbKeyboardLayoutEngine::UsesAltGr() const { 710 bool XkbKeyboardLayoutEngine::UsesAltGr() const {
711 // NOTIMPLEMENTED(); 711 // NOTIMPLEMENTED();
712 return false; 712 return false;
713 } 713 }
714 714
715 bool XkbKeyboardLayoutEngine::Lookup(DomCode dom_code, 715 bool XkbKeyboardLayoutEngine::Lookup(DomCode dom_code,
716 int flags, 716 int flags,
717 DomKey* dom_key, 717 DomKey* dom_key,
718 KeyboardCode* key_code, 718 KeyboardCode* key_code) const {
719 uint32_t* platform_keycode) const {
720 if (dom_code == DomCode::NONE) 719 if (dom_code == DomCode::NONE)
721 return false; 720 return false;
722 // Convert DOM physical key to XKB representation. 721 // Convert DOM physical key to XKB representation.
723 xkb_keycode_t xkb_keycode = key_code_converter_.DomCodeToXkbKeyCode(dom_code); 722 xkb_keycode_t xkb_keycode = key_code_converter_.DomCodeToXkbKeyCode(dom_code);
724 if (xkb_keycode == key_code_converter_.InvalidXkbKeyCode()) { 723 if (xkb_keycode == key_code_converter_.InvalidXkbKeyCode()) {
725 LOG(ERROR) << "No XKB keycode for DomCode 0x" << std::hex 724 LOG(ERROR) << "No XKB keycode for DomCode 0x" << std::hex
726 << static_cast<int>(dom_code) << " '" 725 << static_cast<int>(dom_code) << " '"
727 << KeycodeConverter::DomCodeToCodeString(dom_code) << "'"; 726 << KeycodeConverter::DomCodeToCodeString(dom_code) << "'";
728 return false; 727 return false;
729 } 728 }
730 xkb_mod_mask_t xkb_flags = EventFlagsToXkbFlags(flags); 729 xkb_mod_mask_t xkb_flags = EventFlagsToXkbFlags(flags);
731 // Obtain keysym and character. 730 // Obtain keysym and character.
732 xkb_keysym_t xkb_keysym; 731 xkb_keysym_t xkb_keysym;
733 uint32_t character = 0; 732 uint32_t character = 0;
734 if (!XkbLookup(xkb_keycode, xkb_flags, &xkb_keysym, &character)) 733 if (!XkbLookup(xkb_keycode, xkb_flags, &xkb_keysym, &character))
735 return false; 734 return false;
736 *platform_keycode = xkb_keysym;
737 // Classify the keysym and convert to DOM and VKEY representations. 735 // Classify the keysym and convert to DOM and VKEY representations.
738 *dom_key = NonPrintableXKeySymToDomKey(xkb_keysym); 736 *dom_key = NonPrintableXKeySymToDomKey(xkb_keysym);
739 if (*dom_key == DomKey::NONE) { 737 if (*dom_key == DomKey::NONE) {
740 *dom_key = DomKey::FromCharacter(character); 738 *dom_key = DomKey::FromCharacter(character);
741 *key_code = AlphanumericKeyboardCode(character); 739 *key_code = AlphanumericKeyboardCode(character);
742 if (*key_code == VKEY_UNKNOWN) { 740 if (*key_code == VKEY_UNKNOWN) {
743 *key_code = DifficultKeyboardCode(dom_code, flags, xkb_keycode, xkb_flags, 741 *key_code = DifficultKeyboardCode(dom_code, flags, xkb_keycode, xkb_flags,
744 xkb_keysym, character); 742 xkb_keysym, character);
745 if (*key_code == VKEY_UNKNOWN) 743 if (*key_code == VKEY_UNKNOWN)
746 *key_code = LocatedToNonLocatedKeyboardCode( 744 *key_code = LocatedToNonLocatedKeyboardCode(
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
924 close_index = layout_name.size(); 922 close_index = layout_name.size();
925 *layout_variant = layout_name.substr(parentheses_index + 1, 923 *layout_variant = layout_name.substr(parentheses_index + 1,
926 close_index - parentheses_index - 1); 924 close_index - parentheses_index - 1);
927 } else if (dash_index != std::string::npos) { 925 } else if (dash_index != std::string::npos) {
928 *layout_id = layout_name.substr(0, dash_index); 926 *layout_id = layout_name.substr(0, dash_index);
929 *layout_variant = layout_name.substr(dash_index + 1); 927 *layout_variant = layout_name.substr(dash_index + 1);
930 } 928 }
931 } 929 }
932 930
933 } // namespace ui 931 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698