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

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

Issue 2649233002: Fix a space problem with the use of XkbKeyboardLayoutEngine::xkb_flag_map_ (Closed)
Patch Set: Created 3 years, 11 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 <stddef.h> 7 #include <stddef.h>
8 #include <xkbcommon/xkbcommon-names.h> 8 #include <xkbcommon/xkbcommon-names.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 int ui_flag; 814 int ui_flag;
815 const char* xkb_name; 815 const char* xkb_name;
816 } flags[] = {{ui::EF_SHIFT_DOWN, XKB_MOD_NAME_SHIFT}, 816 } flags[] = {{ui::EF_SHIFT_DOWN, XKB_MOD_NAME_SHIFT},
817 {ui::EF_CONTROL_DOWN, XKB_MOD_NAME_CTRL}, 817 {ui::EF_CONTROL_DOWN, XKB_MOD_NAME_CTRL},
818 {ui::EF_ALT_DOWN, XKB_MOD_NAME_ALT}, 818 {ui::EF_ALT_DOWN, XKB_MOD_NAME_ALT},
819 {ui::EF_COMMAND_DOWN, XKB_MOD_NAME_LOGO}, 819 {ui::EF_COMMAND_DOWN, XKB_MOD_NAME_LOGO},
820 {ui::EF_ALTGR_DOWN, "Mod5"}, 820 {ui::EF_ALTGR_DOWN, "Mod5"},
821 {ui::EF_MOD3_DOWN, "Mod3"}, 821 {ui::EF_MOD3_DOWN, "Mod3"},
822 {ui::EF_CAPS_LOCK_ON, XKB_MOD_NAME_CAPS}}; 822 {ui::EF_CAPS_LOCK_ON, XKB_MOD_NAME_CAPS}};
823 xkb_flag_map_.clear(); 823 xkb_flag_map_.clear();
824 xkb_flag_map_.resize(arraysize(flags)); 824 xkb_flag_map_.resize(arraysize(flags));
spang 2017/01/23 23:29:04 reserve()
825 for (size_t i = 0; i < arraysize(flags); ++i) { 825 for (size_t i = 0; i < arraysize(flags); ++i) {
826 xkb_mod_index_t index = xkb_keymap_mod_get_index(keymap, flags[i].xkb_name); 826 xkb_mod_index_t index = xkb_keymap_mod_get_index(keymap, flags[i].xkb_name);
827 if (index == XKB_MOD_INVALID) { 827 if (index == XKB_MOD_INVALID) {
828 DVLOG(3) << "XKB keyboard layout does not contain " << flags[i].xkb_name; 828 DVLOG(3) << "XKB keyboard layout does not contain " << flags[i].xkb_name;
829 } else { 829 } else {
830 xkb_mod_mask_t flag = static_cast<xkb_mod_mask_t>(1) << index; 830 xkb_mod_mask_t flag = static_cast<xkb_mod_mask_t>(1) << index;
831 XkbFlagMapEntry e = {flags[i].ui_flag, flag}; 831 XkbFlagMapEntry e = {flags[i].ui_flag, flag};
832 xkb_flag_map_.push_back(e); 832 xkb_flag_map_[i] = e;
833 } 833 }
834 } 834 }
835 835
836 // Update num lock mask. 836 // Update num lock mask.
837 num_lock_mod_mask_ = 0; 837 num_lock_mod_mask_ = 0;
838 xkb_mod_index_t num_mod_index = 838 xkb_mod_index_t num_mod_index =
839 xkb_keymap_mod_get_index(keymap, XKB_MOD_NAME_NUM); 839 xkb_keymap_mod_get_index(keymap, XKB_MOD_NAME_NUM);
840 if (num_mod_index != XKB_MOD_INVALID) 840 if (num_mod_index != XKB_MOD_INVALID)
841 num_lock_mod_mask_ = static_cast<xkb_mod_mask_t>(1) << num_mod_index; 841 num_lock_mod_mask_ = static_cast<xkb_mod_mask_t>(1) << num_mod_index;
842 } 842 }
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 close_index = layout_name.size(); 969 close_index = layout_name.size();
970 *layout_variant = layout_name.substr(parentheses_index + 1, 970 *layout_variant = layout_name.substr(parentheses_index + 1,
971 close_index - parentheses_index - 1); 971 close_index - parentheses_index - 1);
972 } else if (dash_index != std::string::npos) { 972 } else if (dash_index != std::string::npos) {
973 *layout_id = layout_name.substr(0, dash_index); 973 *layout_id = layout_name.substr(0, dash_index);
974 *layout_variant = layout_name.substr(dash_index + 1); 974 *layout_variant = layout_name.substr(dash_index + 1);
975 } 975 }
976 } 976 }
977 977
978 } // namespace ui 978 } // 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