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

Unified Diff: ui/events/keycodes/keyboard_code_conversion_x.cc

Issue 664893004: If keysym is ASCII control or space keys, directly map to keycode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: make a list for TTY function and space keys Created 6 years, 2 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: 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..14c317fbe695932c7b28c7e760b0303c853e2a9f 100644
--- a/ui/events/keycodes/keyboard_code_conversion_x.cc
+++ b/ui/events/keycodes/keyboard_code_conversion_x.cc
@@ -459,6 +459,32 @@ KeyboardCode FindVK(const T_MAP& key, const T_MAP* map, size_t size) {
return VKEY_UNKNOWN;
}
+// Check for TTY function keys or space key which should always be mapped
+// based on KeySym, and never fall back to MAP0~MAP3, since some layouts
+// generate them by applying the Control/AltGr modifier to some other key.
+// e.g. in de(neo), AltGr+V generates XK_Enter.
+bool IsTtyFunctionOrSpaceKey(KeySym keysym) {
+ KeySym keysyms[] = {
+ XK_BackSpace,
+ XK_Tab,
+ XK_Linefeed,
+ XK_Clear,
+ XK_Return,
+ XK_Pause,
+ XK_Scroll_Lock,
+ XK_Sys_Req,
+ XK_Escape,
+ XK_Delete,
+ XK_space
+ };
+
+ for (size_t i = 0; i < arraysize(keysyms); ++i) {
+ if (keysyms[i] == keysym)
+ return true;
+ }
+ return false;
+}
+
} // namespace
// Get an ui::KeyboardCode from an X keyevent
@@ -492,7 +518,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) || IsTtyFunctionOrSpaceKey(keysym)) {
return KeyboardCodeFromXKeysym(keysym);
}
« 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