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

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

Issue 8803004: Consolidate two very similar functions; ui::WindowsKeyCodeForGdkKeyCode and ui::KeyboardCodeFromXKey (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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/base/keycodes/keyboard_code_conversion_gtk.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/keycodes/keyboard_code_conversion_x.cc
diff --git a/ui/base/keycodes/keyboard_code_conversion_x.cc b/ui/base/keycodes/keyboard_code_conversion_x.cc
index d9eaa9f9a93972a4a013d9c63dad0ad7f834cc9d..934e9e27a2e3812a617bf7aef93a1538efb72db9 100644
--- a/ui/base/keycodes/keyboard_code_conversion_x.cc
+++ b/ui/base/keycodes/keyboard_code_conversion_x.cc
@@ -4,6 +4,7 @@
#include "ui/base/keycodes/keyboard_code_conversion_x.h"
+#define XK_3270 // for XK_3270_BackTab
sadrul 2011/12/05 16:00:28 This ... looks weird. Why is this necessary? Is th
Yusuke Sato 2011/12/06 04:30:39 The Xlib reference manual says "This file declares
#include <X11/keysym.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
@@ -30,9 +31,6 @@ KeyboardCode KeyboardCodeFromXKeyEvent(XEvent* xev) {
}
KeyboardCode KeyboardCodeFromXKeysym(unsigned int keysym) {
- // Consult GDK key translation (in WindowsKeyCodeForGdkKeyCode) for details
- // about the following translations.
-
// TODO(sad): Have |keysym| go through the X map list?
switch (keysym) {
@@ -43,10 +41,13 @@ KeyboardCode KeyboardCodeFromXKeysym(unsigned int keysym) {
return VKEY_DELETE;
case XK_Tab:
case XK_KP_Tab:
+ case XK_ISO_Left_Tab:
+ case XK_3270_BackTab:
return VKEY_TAB;
case XK_Linefeed:
case XK_Return:
case XK_KP_Enter:
+ case XK_ISO_Enter:
return VKEY_RETURN;
case XK_Clear:
return VKEY_CLEAR;
@@ -79,6 +80,15 @@ KeyboardCode KeyboardCodeFromXKeysym(unsigned int keysym) {
return VKEY_UP;
case XK_Escape:
return VKEY_ESCAPE;
+ case XK_Kana_Lock:
+ case XK_Kana_Shift:
+ return VKEY_KANA;
+ case XK_Hangul:
+ return VKEY_HANGUL;
+ case XK_Hangul_Hanja:
+ return VKEY_HANJA;
+ case XK_Kanji:
+ return VKEY_KANJI;
case XK_A:
case XK_a:
return VKEY_A;
@@ -182,6 +192,27 @@ KeyboardCode KeyboardCodeFromXKeysym(unsigned int keysym) {
case XK_KP_9:
return static_cast<KeyboardCode>(VKEY_NUMPAD0 + (keysym - XK_KP_0));
+ case XK_parenright:
+ return VKEY_0;
+ case XK_exclam:
+ return VKEY_1;
+ case XK_at:
+ return VKEY_2;
+ case XK_numbersign:
+ return VKEY_3;
+ case XK_dollar:
+ return VKEY_4;
+ case XK_percent:
+ return VKEY_5;
+ case XK_asciicircum:
+ return VKEY_6;
+ case XK_ampersand:
+ return VKEY_7;
+ case XK_asterisk:
+ return VKEY_8;
+ case XK_parenleft:
+ return VKEY_9;
+
case XK_multiply:
case XK_KP_Multiply:
return VKEY_MULTIPLY;
« no previous file with comments | « ui/base/keycodes/keyboard_code_conversion_gtk.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698