Chromium Code Reviews| Index: chrome/browser/chromeos/events/event_rewriter.cc |
| diff --git a/chrome/browser/chromeos/events/event_rewriter.cc b/chrome/browser/chromeos/events/event_rewriter.cc |
| index d7497c6ebae6c6b5f58284d0b37ff9d16c736088..192f845239537879e6662ba9d4a5b3f17ed9bee6 100644 |
| --- a/chrome/browser/chromeos/events/event_rewriter.cc |
| +++ b/chrome/browser/chromeos/events/event_rewriter.cc |
| @@ -212,11 +212,22 @@ void EventRewriter::BuildRewrittenKeyEvent( |
| else |
| xkeyevent.xkey = xev->xkey; |
| - // Update native event to match rewritten |ui::Event|. |
| - // The X11 keycode represents a physical key position, so it shouldn't |
| - // change unless we have actually changed keys, not just modifiers. |
| - // This is one guard against problems like crbug.com/390263. |
| - if (key_event.key_code() != key_code) { |
| + // The X11 keycode for numpad keys should always NOT be changed because |
|
Yusuke Sato
2014/08/08 01:04:09
Would you mind adding tests for this? (numpad, num
Shu Chen
2014/08/08 05:44:09
Actually there are test failure for this change. I
|
| + // XKeyCodeForWindowsKeyCode method cannot handle non-US keyboard layout. |
| + // The original X11 keycode should be correct to get the correct keysym. |
|
Yusuke Sato
2014/08/08 01:04:09
This works because ui:: keycode is for accelerator
Shu Chen
2014/08/08 05:44:09
With new solution, no need to add such comments.
|
| + // For SHIFT+NumpadKey cases, use the US keyboard layout. |
| + // Please see crbug.com/335644. |
| + if (key_code >= ui::VKEY_NUMPAD0 && key_code <= ui::VKEY_DIVIDE) { |
| + if (flags & ui::EF_SHIFT_DOWN) { |
| + flags &= ~ui::EF_SHIFT_DOWN; |
| + xkeyevent.xkey.keycode = |
| + XKeyCodeForWindowsKeyCode(key_code, flags, gfx::GetXDisplay()); |
| + } |
| + } else if (key_event.key_code() != key_code) { |
| + // Update native event to match rewritten |ui::Event|. |
| + // The X11 keycode represents a physical key position, so it shouldn't |
| + // change unless we have actually changed keys, not just modifiers. |
| + // This is one guard against problems like crbug.com/390263. |
| xkeyevent.xkey.keycode = |
| XKeyCodeForWindowsKeyCode(key_code, flags, gfx::GetXDisplay()); |
| } |