Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / ui / events / ozone / evdev / keyboard_util_evdev.cc
blob7755a6fe955b330430617d58c992c94644e9dd3f
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ui/events/ozone/evdev/keyboard_util_evdev.h"
7 #include <linux/input.h>
9 #include "ui/events/keycodes/dom/keycode_converter.h"
11 namespace ui {
13 namespace {
15 const int kXkbKeycodeOffset = 8;
17 } // namespace
19 int NativeCodeToEvdevCode(int native_code) {
20 if (native_code == KeycodeConverter::InvalidNativeKeycode())
21 return KEY_RESERVED;
23 return native_code - kXkbKeycodeOffset;
26 int EvdevCodeToNativeCode(int evdev_code) {
27 if (evdev_code == KEY_RESERVED)
28 return KeycodeConverter::InvalidNativeKeycode();
30 return evdev_code + kXkbKeycodeOffset;
33 } // namespace ui