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/tablet_event_converter_evdev.h" | 5 #include "ui/events/ozone/evdev/tablet_event_converter_evdev.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/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "base/trace_event/trace_event.h" |
11 #include "ui/events/event.h" | 12 #include "ui/events/event.h" |
12 #include "ui/events/ozone/evdev/device_event_dispatcher_evdev.h" | 13 #include "ui/events/ozone/evdev/device_event_dispatcher_evdev.h" |
13 | 14 |
14 namespace ui { | 15 namespace ui { |
15 | 16 |
16 TabletEventConverterEvdev::TabletEventConverterEvdev( | 17 TabletEventConverterEvdev::TabletEventConverterEvdev( |
17 int fd, | 18 int fd, |
18 base::FilePath path, | 19 base::FilePath path, |
19 int id, | 20 int id, |
20 InputDeviceType type, | 21 InputDeviceType type, |
(...skipping 16 matching lines...) Expand all Loading... |
37 y_abs_min_ = info.GetAbsMinimum(ABS_Y); | 38 y_abs_min_ = info.GetAbsMinimum(ABS_Y); |
38 y_abs_range_ = info.GetAbsMaximum(ABS_Y) - y_abs_min_ + 1; | 39 y_abs_range_ = info.GetAbsMaximum(ABS_Y) - y_abs_min_ + 1; |
39 } | 40 } |
40 | 41 |
41 TabletEventConverterEvdev::~TabletEventConverterEvdev() { | 42 TabletEventConverterEvdev::~TabletEventConverterEvdev() { |
42 Stop(); | 43 Stop(); |
43 close(fd_); | 44 close(fd_); |
44 } | 45 } |
45 | 46 |
46 void TabletEventConverterEvdev::OnFileCanReadWithoutBlocking(int fd) { | 47 void TabletEventConverterEvdev::OnFileCanReadWithoutBlocking(int fd) { |
| 48 TRACE_EVENT1("evdev", |
| 49 "TabletEventConverterEvdev::OnFileCanReadWithoutBlocking", "fd", |
| 50 fd); |
| 51 |
47 input_event inputs[4]; | 52 input_event inputs[4]; |
48 ssize_t read_size = read(fd, inputs, sizeof(inputs)); | 53 ssize_t read_size = read(fd, inputs, sizeof(inputs)); |
49 if (read_size < 0) { | 54 if (read_size < 0) { |
50 if (errno == EINTR || errno == EAGAIN) | 55 if (errno == EINTR || errno == EAGAIN) |
51 return; | 56 return; |
52 if (errno != ENODEV) | 57 if (errno != ENODEV) |
53 PLOG(ERROR) << "error reading device " << path_.value(); | 58 PLOG(ERROR) << "error reading device " << path_.value(); |
54 Stop(); | 59 Stop(); |
55 return; | 60 return; |
56 } | 61 } |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 UpdateCursor(); | 176 UpdateCursor(); |
172 | 177 |
173 dispatcher_->DispatchMouseMoveEvent( | 178 dispatcher_->DispatchMouseMoveEvent( |
174 MouseMoveEventParams(input_device_.id, cursor_->GetLocation(), | 179 MouseMoveEventParams(input_device_.id, cursor_->GetLocation(), |
175 TimeDeltaFromInputEvent(input))); | 180 TimeDeltaFromInputEvent(input))); |
176 | 181 |
177 abs_value_dirty_ = false; | 182 abs_value_dirty_ = false; |
178 } | 183 } |
179 | 184 |
180 } // namespace ui | 185 } // namespace ui |
OLD | NEW |