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

Side by Side Diff: ui/events/ozone/evdev/gamepad_event_converter_evdev.h

Issue 2893073003: ozone: evdev: Use correct integer width for gamepad axis values (Closed)
Patch Set: Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | ui/events/ozone/evdev/gamepad_event_converter_evdev.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_EVENTS_OZONE_GAMEPAD_EVENT_CONVERTER_EVDEV_H_ 5 #ifndef UI_EVENTS_OZONE_GAMEPAD_EVENT_CONVERTER_EVDEV_H_
6 #define UI_EVENTS_OZONE_GAMEPAD_EVENT_CONVERTER_EVDEV_H_ 6 #define UI_EVENTS_OZONE_GAMEPAD_EVENT_CONVERTER_EVDEV_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 28 matching lines...) Expand all
39 void OnFileCanReadWithoutBlocking(int fd) override; 39 void OnFileCanReadWithoutBlocking(int fd) override;
40 bool HasGamepad() const override; 40 bool HasGamepad() const override;
41 void OnDisabled() override; 41 void OnDisabled() override;
42 42
43 // This function processes one input_event from evdev. 43 // This function processes one input_event from evdev.
44 void ProcessEvent(const struct input_event& input); 44 void ProcessEvent(const struct input_event& input);
45 45
46 private: 46 private:
47 // This function processes EV_KEY event from gamepad device. 47 // This function processes EV_KEY event from gamepad device.
48 void ProcessEvdevKey(uint16_t code, 48 void ProcessEvdevKey(uint16_t code,
49 uint16_t value, 49 int value,
50 const base::TimeTicks& timestamp); 50 const base::TimeTicks& timestamp);
51 51
52 // This function processes EV_ABS event from gamepad device. 52 // This function processes EV_ABS event from gamepad device.
53 void ProcessEvdevAbs(uint16_t code, 53 void ProcessEvdevAbs(uint16_t code,
54 uint16_t value, 54 int value,
55 const base::TimeTicks& timestamp); 55 const base::TimeTicks& timestamp);
56 56
57 // This function releases all the keys and resets all the axises. 57 // This function releases all the keys and resets all the axises.
58 void ResetGamepad(); 58 void ResetGamepad();
59 59
60 // This function reads current gamepad status and resyncs the gamepad. 60 // This function reads current gamepad status and resyncs the gamepad.
61 void ResyncGamepad(); 61 void ResyncGamepad();
62 62
63 void OnButtonChange(unsigned int code, 63 void OnButtonChange(unsigned int code,
64 double value, 64 double value,
(...skipping 10 matching lines...) Expand all
75 75
76 // Internal representation of axis information. 76 // Internal representation of axis information.
77 77
78 class Axis { 78 class Axis {
79 public: 79 public:
80 Axis(); 80 Axis();
81 Axis(const input_absinfo& abs_info, 81 Axis(const input_absinfo& abs_info,
82 GamepadEventType mapped_type, 82 GamepadEventType mapped_type,
83 uint16_t mapped_code); 83 uint16_t mapped_code);
84 84
85 bool MapValue(uint16_t value, double* mapped_value); 85 bool MapValue(int value, double* mapped_value);
86 86
87 GamepadEventType mapped_type(); 87 GamepadEventType mapped_type();
88 88
89 uint16_t mapped_code(); 89 uint16_t mapped_code();
90 90
91 private: 91 private:
92 bool ValueChangeSignificantly(double new_value); 92 bool ValueChangeSignificantly(double new_value);
93 double last_value_; 93 double last_value_;
94 double scale_; 94 double scale_;
95 double offset_; 95 double offset_;
(...skipping 18 matching lines...) Expand all
114 114
115 // Callbacks for dispatching events. 115 // Callbacks for dispatching events.
116 DeviceEventDispatcherEvdev* dispatcher_; 116 DeviceEventDispatcherEvdev* dispatcher_;
117 117
118 DISALLOW_COPY_AND_ASSIGN(GamepadEventConverterEvdev); 118 DISALLOW_COPY_AND_ASSIGN(GamepadEventConverterEvdev);
119 }; 119 };
120 120
121 } // namespace ui 121 } // namespace ui
122 122
123 #endif // UI_EVENTS_OZONE_GAMEPAD_EVENT_CONVERTER_EVDEV_H_ 123 #endif // UI_EVENTS_OZONE_GAMEPAD_EVENT_CONVERTER_EVDEV_H_
OLDNEW
« no previous file with comments | « no previous file | ui/events/ozone/evdev/gamepad_event_converter_evdev.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698