OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #include "ui/events/ozone/evdev/keyboard_util_evdev.h" |
| 6 |
| 7 #include <linux/input.h> |
| 8 |
| 9 #include "ui/events/keycodes/dom4/keycode_converter.h" |
| 10 |
| 11 namespace ui { |
| 12 |
| 13 namespace { |
| 14 |
| 15 const int kXkbKeycodeOffset = 8; |
| 16 |
| 17 } // namespace |
| 18 |
| 19 int NativeCodeToEvdevCode(int native_code) { |
| 20 if (native_code == KeycodeConverter::InvalidNativeKeycode()) |
| 21 return KEY_RESERVED; |
| 22 |
| 23 return native_code - kXkbKeycodeOffset; |
| 24 } |
| 25 |
| 26 int EvdevCodeToNativeCode(int evdev_code) { |
| 27 if (evdev_code == KEY_RESERVED) |
| 28 return KeycodeConverter::InvalidNativeKeycode(); |
| 29 |
| 30 return evdev_code + kXkbKeycodeOffset; |
| 31 } |
| 32 |
| 33 } // namespace ui |
OLD | NEW |