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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 fd_, true, base::MessagePumpLibevent::WATCH_READ, &controller_, this); | 44 fd_, true, base::MessagePumpLibevent::WATCH_READ, &controller_, this); |
45 watching_ = true; | 45 watching_ = true; |
46 } | 46 } |
47 | 47 |
48 void EventConverterEvdev::Stop() { | 48 void EventConverterEvdev::Stop() { |
49 controller_.StopWatchingFileDescriptor(); | 49 controller_.StopWatchingFileDescriptor(); |
50 watching_ = false; | 50 watching_ = false; |
51 } | 51 } |
52 | 52 |
53 void EventConverterEvdev::SetEnabled(bool enabled) { | 53 void EventConverterEvdev::SetEnabled(bool enabled) { |
54 if (enabled == enabled_) | 54 if (enabled == input_device_.enabled) |
55 return; | 55 return; |
56 if (enabled) { | 56 if (enabled) { |
57 TRACE_EVENT1("evdev", "EventConverterEvdev::OnEnabled", "path", | 57 TRACE_EVENT1("evdev", "EventConverterEvdev::OnEnabled", "path", |
58 path_.value()); | 58 path_.value()); |
59 OnEnabled(); | 59 OnEnabled(); |
60 } else { | 60 } else { |
61 TRACE_EVENT1("evdev", "EventConverterEvdev::OnDisabled", "path", | 61 TRACE_EVENT1("evdev", "EventConverterEvdev::OnDisabled", "path", |
62 path_.value()); | 62 path_.value()); |
63 OnDisabled(); | 63 OnDisabled(); |
64 } | 64 } |
65 enabled_ = enabled; | 65 input_device_.enabled = enabled; |
| 66 } |
| 67 |
| 68 bool EventConverterEvdev::IsEnabled() const { |
| 69 return input_device_.enabled; |
66 } | 70 } |
67 | 71 |
68 void EventConverterEvdev::OnStopped() { | 72 void EventConverterEvdev::OnStopped() { |
69 } | 73 } |
70 | 74 |
71 void EventConverterEvdev::OnEnabled() { | 75 void EventConverterEvdev::OnEnabled() { |
72 } | 76 } |
73 | 77 |
74 void EventConverterEvdev::OnDisabled() { | 78 void EventConverterEvdev::OnDisabled() { |
75 } | 79 } |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 | 163 |
160 base::TimeTicks EventConverterEvdev::TimeTicksFromInputEvent( | 164 base::TimeTicks EventConverterEvdev::TimeTicksFromInputEvent( |
161 const input_event& event) { | 165 const input_event& event) { |
162 base::TimeTicks timestamp = | 166 base::TimeTicks timestamp = |
163 ui::EventTimeStampFromSeconds(event.time.tv_sec) + | 167 ui::EventTimeStampFromSeconds(event.time.tv_sec) + |
164 base::TimeDelta::FromMicroseconds(event.time.tv_usec); | 168 base::TimeDelta::FromMicroseconds(event.time.tv_usec); |
165 ValidateEventTimeClock(×tamp); | 169 ValidateEventTimeClock(×tamp); |
166 return timestamp; | 170 return timestamp; |
167 } | 171 } |
168 } // namespace ui | 172 } // namespace ui |
OLD | NEW |