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

Unified Diff: chrome/browser/chromeos/events/event_rewriter.cc

Issue 446693005: Support non-US layout for rewriting Numpad key events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: handled Shift+NumpadKey. Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
}
« 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