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 "ui/events/ozone/evdev/event_converter_evdev_impl.h" | 5 #include "ui/events/ozone/evdev/event_converter_evdev_impl.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <linux/input.h> | 8 #include <linux/input.h> |
9 | 9 |
10 #include "ui/events/event.h" | 10 #include "ui/events/event.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 int fd, | 26 int fd, |
27 base::FilePath path, | 27 base::FilePath path, |
28 int id, | 28 int id, |
29 InputDeviceType type, | 29 InputDeviceType type, |
30 const EventDeviceInfo& devinfo, | 30 const EventDeviceInfo& devinfo, |
31 CursorDelegateEvdev* cursor, | 31 CursorDelegateEvdev* cursor, |
32 DeviceEventDispatcherEvdev* dispatcher) | 32 DeviceEventDispatcherEvdev* dispatcher) |
33 : EventConverterEvdev(fd, path, id, type), | 33 : EventConverterEvdev(fd, path, id, type), |
34 has_keyboard_(devinfo.HasKeyboard()), | 34 has_keyboard_(devinfo.HasKeyboard()), |
35 has_touchpad_(devinfo.HasTouchpad()), | 35 has_touchpad_(devinfo.HasTouchpad()), |
| 36 has_caps_lock_led_(devinfo.HasLedEvent(LED_CAPSL)), |
36 x_offset_(0), | 37 x_offset_(0), |
37 y_offset_(0), | 38 y_offset_(0), |
38 cursor_(cursor), | 39 cursor_(cursor), |
39 dispatcher_(dispatcher) { | 40 dispatcher_(dispatcher) { |
40 } | 41 } |
41 | 42 |
42 EventConverterEvdevImpl::~EventConverterEvdevImpl() { | 43 EventConverterEvdevImpl::~EventConverterEvdevImpl() { |
43 Stop(); | 44 Stop(); |
44 close(fd_); | 45 close(fd_); |
45 } | 46 } |
(...skipping 20 matching lines...) Expand all Loading... |
66 } | 67 } |
67 | 68 |
68 bool EventConverterEvdevImpl::HasKeyboard() const { | 69 bool EventConverterEvdevImpl::HasKeyboard() const { |
69 return has_keyboard_; | 70 return has_keyboard_; |
70 } | 71 } |
71 | 72 |
72 bool EventConverterEvdevImpl::HasTouchpad() const { | 73 bool EventConverterEvdevImpl::HasTouchpad() const { |
73 return has_touchpad_; | 74 return has_touchpad_; |
74 } | 75 } |
75 | 76 |
| 77 bool EventConverterEvdevImpl::HasCapsLockLed() const { |
| 78 return has_caps_lock_led_; |
| 79 } |
| 80 |
76 void EventConverterEvdevImpl::SetAllowedKeys( | 81 void EventConverterEvdevImpl::SetAllowedKeys( |
77 scoped_ptr<std::set<DomCode>> allowed_keys) { | 82 scoped_ptr<std::set<DomCode>> allowed_keys) { |
78 DCHECK(HasKeyboard()); | 83 DCHECK(HasKeyboard()); |
79 allowed_keys_ = allowed_keys.Pass(); | 84 allowed_keys_ = allowed_keys.Pass(); |
80 } | 85 } |
81 | 86 |
82 void EventConverterEvdevImpl::AllowAllKeys() { | 87 void EventConverterEvdevImpl::AllowAllKeys() { |
83 DCHECK(HasKeyboard()); | 88 DCHECK(HasKeyboard()); |
84 allowed_keys_.reset(); | 89 allowed_keys_.reset(); |
85 } | 90 } |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 cursor_->MoveCursor(gfx::Vector2dF(x_offset_, y_offset_)); | 159 cursor_->MoveCursor(gfx::Vector2dF(x_offset_, y_offset_)); |
155 | 160 |
156 dispatcher_->DispatchMouseMoveEvent(MouseMoveEventParams( | 161 dispatcher_->DispatchMouseMoveEvent(MouseMoveEventParams( |
157 id_, cursor_->GetLocation(), TimeDeltaFromInputEvent(input))); | 162 id_, cursor_->GetLocation(), TimeDeltaFromInputEvent(input))); |
158 | 163 |
159 x_offset_ = 0; | 164 x_offset_ = 0; |
160 y_offset_ = 0; | 165 y_offset_ = 0; |
161 } | 166 } |
162 | 167 |
163 } // namespace ui | 168 } // namespace ui |
OLD | NEW |