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 <linux/input.h> | 5 #include <linux/input.h> |
6 | 6 |
7 #include "ui/events/ozone/evdev/event_converter_evdev.h" | 7 #include "ui/events/ozone/evdev/event_converter_evdev.h" |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
12 #include "ui/events/devices/input_device.h" | 12 #include "ui/events/devices/input_device.h" |
13 | 13 |
14 namespace ui { | 14 namespace ui { |
15 | 15 |
16 EventConverterEvdev::EventConverterEvdev(int fd, | 16 EventConverterEvdev::EventConverterEvdev(int fd, |
17 const base::FilePath& path, | 17 const base::FilePath& path, |
18 int id, | 18 int id, |
19 InputDeviceType type, | 19 InputDeviceType type) |
20 const std::string& name, | 20 : fd_(fd), path_(path), id_(id), type_(type), ignore_events_(false) { |
21 uint16_t vendor_id, | |
22 uint16_t product_id) | |
23 : fd_(fd), | |
24 path_(path), | |
25 input_device_(id, type, name, vendor_id, product_id), | |
26 ignore_events_(false) { | |
27 } | 21 } |
28 | 22 |
29 EventConverterEvdev::~EventConverterEvdev() { | 23 EventConverterEvdev::~EventConverterEvdev() { |
30 Stop(); | 24 Stop(); |
31 } | 25 } |
32 | 26 |
33 void EventConverterEvdev::Start() { | 27 void EventConverterEvdev::Start() { |
34 base::MessageLoopForUI::current()->WatchFileDescriptor( | 28 base::MessageLoopForUI::current()->WatchFileDescriptor( |
35 fd_, true, base::MessagePumpLibevent::WATCH_READ, &controller_, this); | 29 fd_, true, base::MessagePumpLibevent::WATCH_READ, &controller_, this); |
36 } | 30 } |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 Stop(); | 107 Stop(); |
114 } | 108 } |
115 } | 109 } |
116 | 110 |
117 base::TimeDelta EventConverterEvdev::TimeDeltaFromInputEvent( | 111 base::TimeDelta EventConverterEvdev::TimeDeltaFromInputEvent( |
118 const input_event& event) { | 112 const input_event& event) { |
119 return base::TimeDelta::FromMicroseconds(event.time.tv_sec * 1000000 + | 113 return base::TimeDelta::FromMicroseconds(event.time.tv_sec * 1000000 + |
120 event.time.tv_usec); | 114 event.time.tv_usec); |
121 } | 115 } |
122 } // namespace ui | 116 } // namespace ui |
OLD | NEW |