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

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

Issue 954943003: [KeyboardEvent] Use DOM |code| rather than Windows-based key code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added missing VKEY in windows for brightness and power Created 5 years, 10 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 | « ui/events/keycodes/keyboard_code_conversion_x.h ('k') | ui/events/keycodes/keyboard_code_conversion_xkb.h » ('j') | 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 48025c436939994b5fe2ebf9186a973182966adb..fa99f495c7d8e245db5b155d139e788b3d48b2f0 100644
--- a/ui/events/keycodes/keyboard_code_conversion_x.cc
+++ b/ui/events/keycodes/keyboard_code_conversion_x.cc
@@ -19,6 +19,7 @@
#include "base/strings/sys_string_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "ui/events/keycodes/dom4/keycode_converter.h"
+#include "ui/events/keycodes/keyboard_code_conversion_xkb.h"
#include "ui/events/x/keysym_to_unicode.h"
#define VKEY_UNSUPPORTED VKEY_UNKNOWN
@@ -883,7 +884,7 @@ DomCode CodeFromXEvent(const XEvent* xev) {
return ui::KeycodeConverter::NativeKeycodeToDomCode(keycode);
}
-uint16 GetCharacterFromXEvent(const XEvent* xev) {
+void GetMeaningFromXEvent(const XEvent* xev, DomKey* key, base::char16* ch) {
XEvent xkeyevent = {0};
const XKeyEvent* xkey = NULL;
if (xev->type == GenericEvent) {
@@ -896,7 +897,15 @@ uint16 GetCharacterFromXEvent(const XEvent* xev) {
}
KeySym keysym = XK_VoidSymbol;
XLookupString(const_cast<XKeyEvent*>(xkey), NULL, 0, &keysym, NULL);
- return GetUnicodeCharacterFromXKeySym(keysym);
+ *ch = GetUnicodeCharacterFromXKeySym(keysym);
+ *key = XkbKeySymToDomKey(keysym, *ch);
+}
+
+uint16 GetCharacterFromXEvent(const XEvent* xev) {
+ base::char16 ch;
+ DomKey key;
+ GetMeaningFromXEvent(xev, &key, &ch);
+ return ch;
}
KeyboardCode DefaultKeyboardCodeFromHardwareKeycode(
« no previous file with comments | « ui/events/keycodes/keyboard_code_conversion_x.h ('k') | ui/events/keycodes/keyboard_code_conversion_xkb.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698