Index: ui/events/keycodes/keyboard_code_conversion_x.cc |
diff --git a/ui/events/keycodes/keyboard_code_conversion_x.cc b/ui/events/keycodes/keyboard_code_conversion_x.cc |
index a4a810e23a43004eb09af168daa797968e6d8a23..ce9bd44481ff8431ef4444d19372378a5187b95c 100644 |
--- a/ui/events/keycodes/keyboard_code_conversion_x.cc |
+++ b/ui/events/keycodes/keyboard_code_conversion_x.cc |
@@ -459,6 +459,15 @@ KeyboardCode FindVK(const T_MAP& key, const T_MAP* map, size_t size) { |
return VKEY_UNKNOWN; |
} |
+// Check for ASCII Control or space keys which should directly map to key code |
+// instead of stripping the modifier states and go through the fallback maps. |
Wez
2014/10/24 22:29:18
_Why_ should they do this, though?
What would Ctr
Wez
2014/10/24 22:31:22
The example you give in CL description is AltGr+V
Shu Chen
2014/10/25 05:46:19
Enter is an ascii control key: keysym=0xff0d (XK_R
Shu Chen
2014/10/25 05:46:19
The range 0xff01-0xff1f contains XK_Tab, XK_Return
|
+bool IsAsciiControlOrSpaceKey(KeySym keysym) { |
+ // 0xff01 to 0xff1f (instead of 0x01 to 0x1f) represent ASCII control in |
+ // keysym world. |
+ return (keysym > 0xff00 && keysym <= 0xff1f) || keysym == XK_Delete || |
+ keysym == XK_Escape || keysym == XK_space; |
+} |
+ |
} // namespace |
// Get an ui::KeyboardCode from an X keyevent |
@@ -492,7 +501,7 @@ KeyboardCode KeyboardCodeFromXKeyEvent(const XEvent* xev) { |
XLookupString(xkey, NULL, 0, &keysym, NULL); |
if (IsKeypadKey(keysym) || IsPrivateKeypadKey(keysym) || |
IsCursorKey(keysym) || IsPFKey(keysym) || IsFunctionKey(keysym) || |
- IsModifierKey(keysym)) { |
+ IsModifierKey(keysym) || IsAsciiControlOrSpaceKey(keysym)) { |
return KeyboardCodeFromXKeysym(keysym); |
} |