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/touch_event_converter_evdev.h" | 5 #include "ui/events/ozone/evdev/touch_event_converter_evdev.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <linux/input.h> | 9 #include <linux/input.h> |
10 #include <poll.h> | 10 #include <poll.h> |
(...skipping 16 matching lines...) Expand all Loading... |
27 namespace { | 27 namespace { |
28 | 28 |
29 // Number is determined empirically. | 29 // Number is determined empirically. |
30 // TODO(rjkroege): Configure this per device. | 30 // TODO(rjkroege): Configure this per device. |
31 const float kFingerWidth = 25.f; | 31 const float kFingerWidth = 25.f; |
32 | 32 |
33 } // namespace | 33 } // namespace |
34 | 34 |
35 namespace ui { | 35 namespace ui { |
36 | 36 |
37 TouchEventConverterEvdev::TouchEventConverterEvdev(int fd, | 37 TouchEventConverterEvdev::TouchEventConverterEvdev( |
38 base::FilePath path, | 38 int fd, |
39 const EventDeviceInfo& info) | 39 base::FilePath path, |
40 : pressure_min_(info.GetAbsMinimum(ABS_MT_PRESSURE)), | 40 const EventDeviceInfo& info, |
| 41 const EventDispatchCallback& callback) |
| 42 : EventConverterEvdev(callback), |
| 43 pressure_min_(info.GetAbsMinimum(ABS_MT_PRESSURE)), |
41 pressure_max_(info.GetAbsMaximum(ABS_MT_PRESSURE)), | 44 pressure_max_(info.GetAbsMaximum(ABS_MT_PRESSURE)), |
42 x_scale_(1.), | 45 x_scale_(1.), |
43 y_scale_(1.), | 46 y_scale_(1.), |
44 x_min_(info.GetAbsMinimum(ABS_MT_POSITION_X)), | 47 x_min_(info.GetAbsMinimum(ABS_MT_POSITION_X)), |
45 x_max_(info.GetAbsMaximum(ABS_MT_POSITION_X)), | 48 x_max_(info.GetAbsMaximum(ABS_MT_POSITION_X)), |
46 y_min_(info.GetAbsMinimum(ABS_MT_POSITION_Y)), | 49 y_min_(info.GetAbsMinimum(ABS_MT_POSITION_Y)), |
47 y_max_(info.GetAbsMaximum(ABS_MT_POSITION_Y)), | 50 y_max_(info.GetAbsMaximum(ABS_MT_POSITION_Y)), |
48 current_slot_(0), | 51 current_slot_(0), |
49 fd_(fd), | 52 fd_(fd), |
50 path_(path) { | 53 path_(path) { |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 NOTIMPLEMENTED() << "invalid type: " << input.type; | 181 NOTIMPLEMENTED() << "invalid type: " << input.type; |
179 } | 182 } |
180 } | 183 } |
181 for (ScopedVector<ui::TouchEvent>::iterator iter = touch_events.begin(); | 184 for (ScopedVector<ui::TouchEvent>::iterator iter = touch_events.begin(); |
182 iter != touch_events.end(); ++iter) { | 185 iter != touch_events.end(); ++iter) { |
183 DispatchEventToCallback(*iter); | 186 DispatchEventToCallback(*iter); |
184 } | 187 } |
185 } | 188 } |
186 | 189 |
187 } // namespace ui | 190 } // namespace ui |
OLD | NEW |