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

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

Issue 237363005: Convert chromeos::EventRewriter to a ui::EventRewriter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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
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 b21164e63385deb322baed849fc9eb807cbe4735..dea3899fe278b57cb6cd8d2be9417f87eaf33b17 100644
--- a/ui/events/keycodes/keyboard_code_conversion_x.cc
+++ b/ui/events/keycodes/keyboard_code_conversion_x.cc
@@ -14,6 +14,7 @@
#include "base/logging.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
+#include "ui/events/event_constants.h"
#include "ui/events/keycodes/dom4/keycode_converter.h"
namespace ui {
@@ -426,6 +427,51 @@ KeyboardCode KeyboardCodeFromXKeysym(unsigned int keysym) {
return VKEY_UNKNOWN;
}
+int EventFlagsFromXKeysym(unsigned int keysym) {
+ static const unsigned int numpad_keysyms[] = {
sadrul 2014/04/14 21:51:32 Does this need to be static?
kpschoedel 2014/04/14 22:25:45 If it's not static, the compiler is expected to tr
+ XK_KP_Delete,
+ XK_KP_Tab,
+ XK_KP_Enter,
+ XK_KP_Begin,
+ XK_KP_Space,
+ XK_KP_Home,
+ XK_KP_End,
+ XK_KP_Page_Up, // aka XK_KP_Prior
+ XK_KP_Page_Down, // aka XK_KP_Next
+ XK_KP_Left,
+ XK_KP_Right,
+ XK_KP_Down,
+ XK_KP_Up,
+ XK_KP_0,
+ XK_KP_1,
+ XK_KP_2,
+ XK_KP_3,
+ XK_KP_4,
+ XK_KP_5,
+ XK_KP_6,
+ XK_KP_7,
+ XK_KP_8,
+ XK_KP_9,
+ XK_KP_Multiply,
+ XK_KP_Add,
+ XK_KP_Separator,
+ XK_KP_Subtract,
+ XK_KP_Decimal,
+ XK_KP_Divide,
+ XK_KP_Equal,
+ XK_KP_Insert,
+ XK_KP_F1,
+ XK_KP_F2,
+ XK_KP_F3,
+ XK_KP_F4,
+ };
+ for (size_t i = 0; i < arraysize(numpad_keysyms); ++i) {
+ if (numpad_keysyms[i] == keysym)
+ return EF_NUMPAD;
sadrul 2014/04/14 21:51:32 There's an IsKeypadKey macro in X11/Xutil.h. Can w
kpschoedel 2014/04/14 22:25:45 Yes, thanks for pointing that out.
+ }
+ return EF_NONE;
+}
+
const char* CodeFromXEvent(XEvent* xev) {
return KeycodeConverter::GetInstance()->NativeKeycodeToCode(
xev->xkey.keycode);

Powered by Google App Engine
This is Rietveld 408576698