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

Unified Diff: ui/events/ozone/evdev/keyboard_evdev.cc

Issue 806693009: Port ScopedDisableInternalMouseAndKeyboardX11 to Ozone (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
Index: ui/events/ozone/evdev/keyboard_evdev.cc
diff --git a/ui/events/ozone/evdev/keyboard_evdev.cc b/ui/events/ozone/evdev/keyboard_evdev.cc
index 184048dafc4aa088efaa59a73ef96ca9d3d5ca6c..87b8df5aa3b40f5dbd498bab88248546a6e18707 100644
--- a/ui/events/ozone/evdev/keyboard_evdev.cc
+++ b/ui/events/ozone/evdev/keyboard_evdev.cc
@@ -14,7 +14,49 @@ namespace {
const int kXkbKeycodeOffset = 8;
-ui::KeyboardCode KeyboardCodeFromEvdevKey(unsigned int code) {
+int ModifierFromEvdevKey(unsigned int code) {
kpschoedel 2014/12/22 19:17:56 The base version here is fatally out of date now.
+ switch (code) {
+ case KEY_CAPSLOCK:
+ return EVDEV_MODIFIER_CAPS_LOCK;
+ case KEY_LEFTSHIFT:
+ case KEY_RIGHTSHIFT:
+ return EVDEV_MODIFIER_SHIFT;
+ case KEY_LEFTCTRL:
+ case KEY_RIGHTCTRL:
+ return EVDEV_MODIFIER_CONTROL;
+ case KEY_LEFTALT:
+ case KEY_RIGHTALT:
+ return EVDEV_MODIFIER_ALT;
+ case BTN_LEFT:
+ return EVDEV_MODIFIER_LEFT_MOUSE_BUTTON;
+ case BTN_MIDDLE:
+ return EVDEV_MODIFIER_MIDDLE_MOUSE_BUTTON;
+ case BTN_RIGHT:
+ return EVDEV_MODIFIER_RIGHT_MOUSE_BUTTON;
+ case KEY_LEFTMETA:
+ case KEY_RIGHTMETA:
+ return EVDEV_MODIFIER_COMMAND;
+ default:
+ return EVDEV_MODIFIER_NONE;
+ }
+}
+
+bool IsModifierLockKeyFromEvdevKey(unsigned int code) {
+ return code == KEY_CAPSLOCK;
+}
+
+} // namespace
+
+KeyboardEvdev::KeyboardEvdev(EventModifiersEvdev* modifiers,
+ const EventDispatchCallback& callback)
+ : callback_(callback), modifiers_(modifiers) {
+}
+
+KeyboardEvdev::~KeyboardEvdev() {
+}
+
+// static
+ui::KeyboardCode KeyboardEvdev::KeyboardCodeFromEvdevKey(unsigned int code) {
static const ui::KeyboardCode kLinuxBaseKeyMap[] = {
ui::VKEY_UNKNOWN, // KEY_RESERVED
ui::VKEY_ESCAPE, // KEY_ESC
@@ -153,47 +195,6 @@ ui::KeyboardCode KeyboardCodeFromEvdevKey(unsigned int code) {
return ui::VKEY_UNKNOWN;
}
-int ModifierFromEvdevKey(unsigned int code) {
- switch (code) {
- case KEY_CAPSLOCK:
- return EVDEV_MODIFIER_CAPS_LOCK;
- case KEY_LEFTSHIFT:
- case KEY_RIGHTSHIFT:
- return EVDEV_MODIFIER_SHIFT;
- case KEY_LEFTCTRL:
- case KEY_RIGHTCTRL:
- return EVDEV_MODIFIER_CONTROL;
- case KEY_LEFTALT:
- case KEY_RIGHTALT:
- return EVDEV_MODIFIER_ALT;
- case BTN_LEFT:
- return EVDEV_MODIFIER_LEFT_MOUSE_BUTTON;
- case BTN_MIDDLE:
- return EVDEV_MODIFIER_MIDDLE_MOUSE_BUTTON;
- case BTN_RIGHT:
- return EVDEV_MODIFIER_RIGHT_MOUSE_BUTTON;
- case KEY_LEFTMETA:
- case KEY_RIGHTMETA:
- return EVDEV_MODIFIER_COMMAND;
- default:
- return EVDEV_MODIFIER_NONE;
- }
-}
-
-bool IsModifierLockKeyFromEvdevKey(unsigned int code) {
- return code == KEY_CAPSLOCK;
-}
-
-} // namespace
-
-KeyboardEvdev::KeyboardEvdev(EventModifiersEvdev* modifiers,
- const EventDispatchCallback& callback)
- : callback_(callback), modifiers_(modifiers) {
-}
-
-KeyboardEvdev::~KeyboardEvdev() {
-}
-
void KeyboardEvdev::OnKeyChange(unsigned int key, bool down) {
if (key > KEY_MAX)
return;

Powered by Google App Engine
This is Rietveld 408576698