| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2017 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 #ifndef UI_EVENTS_OZONE_GAMEPAD_MAPPING_H_ |
| 6 #define UI_EVENTS_OZONE_GAMEPAD_MAPPING_H_ |
| 7 |
| 8 #include <linux/input.h> |
| 9 #include <vector> |
| 10 #include "base/logging.h" |
| 11 |
| 12 namespace ui { |
| 13 |
| 14 // The following HATX and HATY is not part of web gamepad definition, but we |
| 15 // need to specially treat them cause HAT_Y can be mapped to DPAD_UP or |
| 16 // DPAD_DOWN, and HAT_X can be mapped to DAPD_LEFT or DPAD_RIGHT. |
| 17 constexpr int kHAT_X = 4; |
| 18 constexpr int kHAT_Y = 5; |
| 19 |
| 20 enum class GamepadEventType { BUTTON, AXIS }; |
| 21 |
| 22 // This is the mapping entry to map evdev event to webgamepad event. |
| 23 struct GamepadMappingEntry { |
| 24 uint16_t evdev_type; |
| 25 uint16_t evdev_code; |
| 26 GamepadEventType mapped_type; |
| 27 uint16_t mapped_code; |
| 28 }; |
| 29 |
| 30 // This function will return the a set of mapping for the vendor_id/product_id. |
| 31 std::vector<GamepadMappingEntry>* GetGamepadMapping(uint16_t vendor_id, |
| 32 uint16_t product_id); |
| 33 }; // namespace ui |
| 34 |
| 35 #endif // UI_EVENTS_OZONE_GAMEPAD_MAPPING_H_ |
| OLD | NEW |