OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include <errno.h> | 5 #include <errno.h> |
6 #include <linux/input.h> | 6 #include <linux/input.h> |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "ui/events/ozone/evdev/event_converter_evdev.h" | 9 #include "ui/events/ozone/evdev/event_converter_evdev.h" |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 EventConverterEvdev::EventConverterEvdev(int fd, | 22 EventConverterEvdev::EventConverterEvdev(int fd, |
23 const base::FilePath& path, | 23 const base::FilePath& path, |
24 int id, | 24 int id, |
25 InputDeviceType type, | 25 InputDeviceType type, |
26 const std::string& name, | 26 const std::string& name, |
27 uint16_t vendor_id, | 27 uint16_t vendor_id, |
28 uint16_t product_id) | 28 uint16_t product_id) |
29 : fd_(fd), | 29 : fd_(fd), |
30 path_(path), | 30 path_(path), |
31 input_device_(id, type, name, GetInputPathInSys(path), vendor_id, | 31 input_device_(id, |
32 product_id) {} | 32 type, |
| 33 name, |
| 34 GetInputPathInSys(path), |
| 35 vendor_id, |
| 36 product_id), |
| 37 controller_(FROM_HERE) {} |
33 | 38 |
34 EventConverterEvdev::~EventConverterEvdev() { | 39 EventConverterEvdev::~EventConverterEvdev() { |
35 DCHECK(!enabled_); | 40 DCHECK(!enabled_); |
36 DCHECK(!watching_); | 41 DCHECK(!watching_); |
37 } | 42 } |
38 | 43 |
39 void EventConverterEvdev::Start() { | 44 void EventConverterEvdev::Start() { |
40 base::MessageLoopForUI::current()->WatchFileDescriptor( | 45 base::MessageLoopForUI::current()->WatchFileDescriptor( |
41 fd_, true, base::MessagePumpLibevent::WATCH_READ, &controller_, this); | 46 fd_, true, base::MessagePumpLibevent::WATCH_READ, &controller_, this); |
42 watching_ = true; | 47 watching_ = true; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 | 157 |
153 base::TimeTicks EventConverterEvdev::TimeTicksFromInputEvent( | 158 base::TimeTicks EventConverterEvdev::TimeTicksFromInputEvent( |
154 const input_event& event) { | 159 const input_event& event) { |
155 base::TimeTicks timestamp = | 160 base::TimeTicks timestamp = |
156 ui::EventTimeStampFromSeconds(event.time.tv_sec) + | 161 ui::EventTimeStampFromSeconds(event.time.tv_sec) + |
157 base::TimeDelta::FromMicroseconds(event.time.tv_usec); | 162 base::TimeDelta::FromMicroseconds(event.time.tv_usec); |
158 ValidateEventTimeClock(×tamp); | 163 ValidateEventTimeClock(×tamp); |
159 return timestamp; | 164 return timestamp; |
160 } | 165 } |
161 } // namespace ui | 166 } // namespace ui |
OLD | NEW |