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 "base/trace_event/trace_event.h" |
10 #include "ui/events/event.h" | 11 #include "ui/events/event.h" |
11 #include "ui/events/event_utils.h" | 12 #include "ui/events/event_utils.h" |
12 #include "ui/events/keycodes/dom4/keycode_converter.h" | 13 #include "ui/events/keycodes/dom4/keycode_converter.h" |
13 #include "ui/events/ozone/evdev/device_event_dispatcher_evdev.h" | 14 #include "ui/events/ozone/evdev/device_event_dispatcher_evdev.h" |
14 #include "ui/events/ozone/evdev/keyboard_util_evdev.h" | 15 #include "ui/events/ozone/evdev/keyboard_util_evdev.h" |
15 | 16 |
16 namespace ui { | 17 namespace ui { |
17 | 18 |
18 namespace { | 19 namespace { |
19 | 20 |
(...skipping 26 matching lines...) Expand all Loading... |
46 cursor_(cursor), | 47 cursor_(cursor), |
47 dispatcher_(dispatcher) { | 48 dispatcher_(dispatcher) { |
48 } | 49 } |
49 | 50 |
50 EventConverterEvdevImpl::~EventConverterEvdevImpl() { | 51 EventConverterEvdevImpl::~EventConverterEvdevImpl() { |
51 Stop(); | 52 Stop(); |
52 close(fd_); | 53 close(fd_); |
53 } | 54 } |
54 | 55 |
55 void EventConverterEvdevImpl::OnFileCanReadWithoutBlocking(int fd) { | 56 void EventConverterEvdevImpl::OnFileCanReadWithoutBlocking(int fd) { |
| 57 TRACE_EVENT1("evdev", "EventConverterEvdevImpl::OnFileCanReadWithoutBlocking", |
| 58 "fd", fd); |
| 59 |
56 input_event inputs[4]; | 60 input_event inputs[4]; |
57 ssize_t read_size = read(fd, inputs, sizeof(inputs)); | 61 ssize_t read_size = read(fd, inputs, sizeof(inputs)); |
58 if (read_size < 0) { | 62 if (read_size < 0) { |
59 if (errno == EINTR || errno == EAGAIN) | 63 if (errno == EINTR || errno == EAGAIN) |
60 return; | 64 return; |
61 if (errno != ENODEV) | 65 if (errno != ENODEV) |
62 PLOG(ERROR) << "error reading device " << path_.value(); | 66 PLOG(ERROR) << "error reading device " << path_.value(); |
63 Stop(); | 67 Stop(); |
64 return; | 68 return; |
65 } | 69 } |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 | 247 |
244 dispatcher_->DispatchMouseMoveEvent( | 248 dispatcher_->DispatchMouseMoveEvent( |
245 MouseMoveEventParams(input_device_.id, cursor_->GetLocation(), | 249 MouseMoveEventParams(input_device_.id, cursor_->GetLocation(), |
246 TimeDeltaFromInputEvent(input))); | 250 TimeDeltaFromInputEvent(input))); |
247 | 251 |
248 x_offset_ = 0; | 252 x_offset_ = 0; |
249 y_offset_ = 0; | 253 y_offset_ = 0; |
250 } | 254 } |
251 | 255 |
252 } // namespace ui | 256 } // namespace ui |
OLD | NEW |