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 4235fca327cbfef0ca8de8c7fdd9aef219b9ffe0..494caffcc687bbe5ea93e2a1de175908855d60a2 100644 |
--- a/ui/base/keycodes/keyboard_code_conversion_x.cc |
+++ b/ui/base/keycodes/keyboard_code_conversion_x.cc |
@@ -6,9 +6,11 @@ |
#include <X11/keysym.h> |
#include <X11/Xlib.h> |
+#include <X11/Xutil.h> |
#include "base/basictypes.h" |
#include "base/logging.h" |
+#include "base/utf_string_conversions.h" |
namespace ui { |
@@ -289,6 +291,16 @@ KeyboardCode KeyboardCodeFromXKeysym(unsigned int keysym) { |
return VKEY_UNKNOWN; |
} |
+unsigned int DefaultSymbolFromXEvent(XEvent* xev) { |
+ char buf[6]; |
+ int bytes_written = XLookupString(&xev->xkey, buf, 6, NULL, NULL); |
+ DCHECK_LE(bytes_written, 6); |
+ |
+ string16 result; |
+ return (bytes_written > 0 && UTF8ToUTF16(buf, bytes_written, &result) && |
+ result.length() == 1) ? result[0] : 0; |
+} |
+ |
unsigned int DefaultXKeysymFromHardwareKeycode(unsigned int hardware_code) { |
static const unsigned int kHardwareKeycodeMap[] = { |
0, // 0x00: |