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

Unified Diff: ui/events/test/events_test_utils_x11.cc

Issue 357613002: Gets correct KeyboardCode from XEvent for non-US layouts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git cl format Created 6 years, 6 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 | « ui/events/keycodes/keyboard_code_conversion_x.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/test/events_test_utils_x11.cc
diff --git a/ui/events/test/events_test_utils_x11.cc b/ui/events/test/events_test_utils_x11.cc
index 40d5d4a0dbb0274349f328c4309b811ec2a06af7..622684de93659fb66ce43839710710d1ccacb721 100644
--- a/ui/events/test/events_test_utils_x11.cc
+++ b/ui/events/test/events_test_utils_x11.cc
@@ -63,12 +63,11 @@ int XIButtonEventType(ui::EventType type) {
unsigned int XKeyEventKeyCode(ui::KeyboardCode key_code,
int flags,
XDisplay* display) {
- const int keysym = XKeysymForWindowsKeyCode(key_code,
- flags & ui::EF_SHIFT_DOWN);
- // Tests assume the keycode for XK_less is equal to the one of XK_comma,
- // but XKeysymToKeycode returns 94 for XK_less while it returns 59 for
- // XK_comma. Here we convert the value for XK_less to the value for XK_comma.
- return (keysym == XK_less) ? 59 : XKeysymToKeycode(display, keysym);
+ // XKeyEvent keycode is hardware keycode which doesn't consider SHIFT state.
+ // There are bugs in XKeysymToKeycode that it returns wrong keycode for keysym
+ // with SHIFT state. e.g. XK_less should return 59 but returns 94;
+ // XK_parenright should return 19 but returns 188; etc.
+ return XKeysymToKeycode(display, XKeysymForWindowsKeyCode(key_code, false));
}
// Converts Aura event type and flag to X button event.
« no previous file with comments | « ui/events/keycodes/keyboard_code_conversion_x.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698