Chromium Code Reviews| Index: chrome/browser/ui/ash/event_rewriter.cc |
| diff --git a/chrome/browser/ui/ash/event_rewriter.cc b/chrome/browser/ui/ash/event_rewriter.cc |
| index ad5fdec8222933b98b2b6ea4d600ac8061314596..f47918ae1ee3e0bcb79b23211bb50d5186e6753a 100644 |
| --- a/chrome/browser/ui/ash/event_rewriter.cc |
| +++ b/chrome/browser/ui/ash/event_rewriter.cc |
| @@ -85,6 +85,7 @@ const struct ModifierFlagToPrefName { |
| { Mod4Mask, 0, prefs::kLanguageRemapSearchKeyTo }, |
| { ControlMask, ui::EF_CONTROL_DOWN, prefs::kLanguageRemapControlKeyTo }, |
| { Mod1Mask, ui::EF_ALT_DOWN, prefs::kLanguageRemapAltKeyTo }, |
| + { Mod2Mask, 0, prefs::kLanguageRemapDiamondKeyTo }, |
| }; |
| // Gets a remapped key for |pref_name| key. For example, to find out which |
| @@ -122,6 +123,11 @@ bool HasChromeOSKeyboard() { |
| switches::kHasChromeOSKeyboard); |
| } |
| +bool HasDiamondKey() { |
| + return CommandLine::ForCurrentProcess()->HasSwitch( |
| + switches::kHasChromeOSDiamondKey); |
| +} |
| + |
| bool IsMod3UsedByCurrentInputMethod() { |
| // Since both German Neo2 XKB layout and Caps Lock depend on Mod3Mask, |
| // it's not possible to make both features work. For now, we don't remap |
| @@ -426,7 +432,7 @@ void EventRewriter::GetRemappedModifierMasks( |
| (original_flags & ~(ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN)) | |
| *remapped_flags; |
| - unsigned int native_mask = Mod4Mask | ControlMask | Mod1Mask; |
| + unsigned int native_mask = Mod4Mask | ControlMask | Mod1Mask | Mod2Mask; |
| if (!skip_mod3) |
| native_mask |= Mod3Mask; |
| *remapped_native_modifiers = |
| @@ -467,6 +473,15 @@ bool EventRewriter::RewriteModifiers(ui::KeyEvent* event) { |
| // First, remap |keysym|. |
| const ModifierRemapping* remapped_key = NULL; |
| switch (keysym) { |
| + // On Chrome OS, XF86XK_Launch6 (F15) with Mod2Mask is sent when Diamond |
| + // key is pressed. |
| + case XF86XK_Launch6: |
| + if (HasDiamondKey()) |
| + remapped_key = |
| + GetRemappedKey(prefs::kLanguageRemapDiamondKeyTo, *pref_service); |
| + if (!remapped_key) |
|
Yusuke Sato
2013/01/24 20:46:01
why not else?
do you mean that GetRemappedKey may
yoshiki
2013/01/25 01:33:10
I want to make the default behaviour as ctrl key w
Yusuke Sato
2013/01/25 01:49:32
hrm.. this might be a silly question but could you
yoshiki
2013/01/25 01:53:29
The comment in GetRemappedKey() says 'On login scr
|
| + remapped_key = kModifierRemappingCtrl; |
| + break; |
| // On Chrome OS, XF86XK_Launch7 (F16) with Mod3Mask is sent when Caps Lock |
| // is pressed (with one exception: when IsMod3UsedByCurrentInputMethod() is |
| // true, the key generates XK_ISO_Level3_Shift with Mod3Mask, not |