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

Unified Diff: ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc

Issue 1566463002: Generate located Windows keycodes for number pad keys under Ozone (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc
diff --git a/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc b/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc
index d507d444ca4ec3d6b4076f5f4a7027069db83159..4a37e38893c9c6c823b7c2374934b299f5ee99d4 100644
--- a/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc
+++ b/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc
@@ -31,10 +31,15 @@ typedef base::Callback<void(const std::string&,
scoped_ptr<char, base::FreeDeleter>)>
LoadKeymapCallback;
-KeyboardCode AlphanumericKeyboardCode(base::char16 character) {
+KeyboardCode AlphanumericKeyboardCode(xkb_keysym_t xkb_keysym,
+ base::char16 character) {
// Plain ASCII letters and digits map directly to VKEY values.
- if ((character >= '0') && (character <= '9'))
- return static_cast<KeyboardCode>(VKEY_0 + character - '0');
+ if ((character >= '0') && (character <= '9')) {
+ int zero = ((xkb_keysym >= XKB_KEY_KP_0) && (xkb_keysym <= XKB_KEY_KP_9))
+ ? VKEY_NUMPAD0
+ : VKEY_0;
+ return static_cast<KeyboardCode>(zero + character - '0');
+ }
if ((character >= 'a') && (character <= 'z'))
return static_cast<KeyboardCode>(VKEY_A + character - 'a');
if ((character >= 'A') && (character <= 'Z'))
@@ -775,7 +780,7 @@ bool XkbKeyboardLayoutEngine::Lookup(DomCode dom_code,
}
*dom_key = DomKey::FromCharacter(character);
- *key_code = AlphanumericKeyboardCode(character);
+ *key_code = AlphanumericKeyboardCode(xkb_keysym, character);
if (*key_code == VKEY_UNKNOWN) {
*key_code = DifficultKeyboardCode(dom_code, flags, xkb_keycode, xkb_flags,
xkb_keysym, character);
@@ -876,7 +881,7 @@ KeyboardCode XkbKeyboardLayoutEngine::DifficultKeyboardCode(
return NonPrintableDomKeyToKeyboardCode(plain_key);
// Plain ASCII letters and digits map directly to VKEY values.
- KeyboardCode key_code = AlphanumericKeyboardCode(plain_character);
+ KeyboardCode key_code = AlphanumericKeyboardCode(xkb_keysym, plain_character);
if (key_code != VKEY_UNKNOWN)
return key_code;
« no previous file with comments | « no previous file | ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698