diff options
author | zork@chromium.org <zork@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-12 13:03:28 +0000 |
---|---|---|
committer | zork@chromium.org <zork@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-12 13:03:28 +0000 |
commit | 0d80b8cb59db7ed226f7b5ff75afd268df9f46fe (patch) | |
tree | 69a950551cf7b181ddc8a7205069612461440b1a /chrome/browser/chromeos | |
parent | 08d39cd63864f6992acef9c966465e1e1b5216e7 (diff) | |
download | chromium_src-0d80b8cb59db7ed226f7b5ff75afd268df9f46fe.zip chromium_src-0d80b8cb59db7ed226f7b5ff75afd268df9f46fe.tar.gz chromium_src-0d80b8cb59db7ed226f7b5ff75afd268df9f46fe.tar.bz2 |
Fix AltGr and Search key mapping
R=yusukes@chromium.org
BUG=chromium-os:17484
TEST=Manual
Review URL: http://codereview.chromium.org/7344006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92161 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos')
-rw-r--r-- | chrome/browser/chromeos/input_method/input_method_util.cc | 9 | ||||
-rw-r--r-- | chrome/browser/chromeos/input_method/input_method_util.h | 10 | ||||
-rw-r--r-- | chrome/browser/chromeos/input_method/xkeyboard.cc | 4 |
3 files changed, 21 insertions, 2 deletions
diff --git a/chrome/browser/chromeos/input_method/input_method_util.cc b/chrome/browser/chromeos/input_method/input_method_util.cc index 5c3ac96..cb5e0fe 100644 --- a/chrome/browser/chromeos/input_method/input_method_util.cc +++ b/chrome/browser/chromeos/input_method/input_method_util.cc @@ -506,6 +506,15 @@ std::string GetKeyboardOverlayId(const std::string& input_method_id) { return ""; } +std::string GetKeyboardOverlayIdFromXkb(const std::string& xkb_layout_id) { + for (size_t i = 0; i < arraysize(kIBusEngines); ++i) { + if (kIBusEngines[i].xkb_layout_id == xkb_layout_id) { + return kIBusEngines[i].keyboard_overlay_id; + } + } + return ""; +} + std::string GetInputMethodDisplayNameFromId( const std::string& input_method_id) { const std::string display_name = diff --git a/chrome/browser/chromeos/input_method/input_method_util.h b/chrome/browser/chromeos/input_method/input_method_util.h index 4e17744..6a729a8 100644 --- a/chrome/browser/chromeos/input_method/input_method_util.h +++ b/chrome/browser/chromeos/input_method/input_method_util.h @@ -93,6 +93,16 @@ std::string GetKeyboardLayoutName(const std::string& input_method_id); // "xkb:gb::eng" => "en_GB" std::string GetKeyboardOverlayId(const std::string& input_method_id); +// Gets the ID for the keyboard overlay from the given xkb layout ID. +// If the ID is invalid, an empty string will be returned. +// +// Examples: +// +// "us" => "en_US" +// "us(dvorak)" => "en_US_dvorak" +// "gb(extd)" => "en_GB" +std::string GetKeyboardOverlayIdFromXkb(const std::string& xkb_layout_id); + // Converts an input method ID to a language code of the IME. Returns "Eng" // when |input_method_id| is unknown. // Example: "hangul" => "ko" diff --git a/chrome/browser/chromeos/input_method/xkeyboard.cc b/chrome/browser/chromeos/input_method/xkeyboard.cc index 430e47d..270672d 100644 --- a/chrome/browser/chromeos/input_method/xkeyboard.cc +++ b/chrome/browser/chromeos/input_method/xkeyboard.cc @@ -85,7 +85,7 @@ const char* kCapsLockRemapped[] = { bool KeepRightAlt(const std::string& layout_name) { for (size_t c = 0; c < arraysize(kKeepRightAltOverlays); ++c) { - if (GetKeyboardOverlayId(layout_name) == kKeepRightAltOverlays[c]) { + if (GetKeyboardOverlayIdFromXkb(layout_name) == kKeepRightAltOverlays[c]) { return true; } } @@ -94,7 +94,7 @@ bool KeepRightAlt(const std::string& layout_name) { bool KeepCapsLock(const std::string& layout_name) { for (size_t c = 0; c < arraysize(kCapsLockRemapped); ++c) { - if (GetKeyboardOverlayId(layout_name) == kCapsLockRemapped[c]) { + if (GetKeyboardOverlayIdFromXkb(layout_name) == kCapsLockRemapped[c]) { return true; } } |