| 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 #include <stddef.h> | 9 #include <stddef.h> |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 EventPointerType GetToolType(int button_tool) { | 25 EventPointerType GetToolType(int button_tool) { |
| 26 if (button_tool == BTN_TOOL_RUBBER) | 26 if (button_tool == BTN_TOOL_RUBBER) |
| 27 return EventPointerType::POINTER_TYPE_ERASER; | 27 return EventPointerType::POINTER_TYPE_ERASER; |
| 28 return EventPointerType::POINTER_TYPE_PEN; | 28 return EventPointerType::POINTER_TYPE_PEN; |
| 29 } | 29 } |
| 30 | 30 |
| 31 } // namespace | 31 } // namespace |
| 32 | 32 |
| 33 TabletEventConverterEvdev::TabletEventConverterEvdev( | 33 TabletEventConverterEvdev::TabletEventConverterEvdev( |
| 34 int fd, | 34 ScopedInputDevice fd, |
| 35 base::FilePath path, | 35 base::FilePath path, |
| 36 int id, | 36 int id, |
| 37 CursorDelegateEvdev* cursor, | 37 CursorDelegateEvdev* cursor, |
| 38 const EventDeviceInfo& info, | 38 const EventDeviceInfo& info, |
| 39 DeviceEventDispatcherEvdev* dispatcher) | 39 DeviceEventDispatcherEvdev* dispatcher) |
| 40 : EventConverterEvdev(fd, | 40 : EventConverterEvdev(fd.get(), |
| 41 path, | 41 path, |
| 42 id, | 42 id, |
| 43 info.device_type(), | 43 info.device_type(), |
| 44 info.name(), | 44 info.name(), |
| 45 info.vendor_id(), | 45 info.vendor_id(), |
| 46 info.product_id()), | 46 info.product_id()), |
| 47 input_device_fd_(std::move(fd)), |
| 47 cursor_(cursor), | 48 cursor_(cursor), |
| 48 dispatcher_(dispatcher) { | 49 dispatcher_(dispatcher) { |
| 49 x_abs_min_ = info.GetAbsMinimum(ABS_X); | 50 x_abs_min_ = info.GetAbsMinimum(ABS_X); |
| 50 x_abs_range_ = info.GetAbsMaximum(ABS_X) - x_abs_min_ + 1; | 51 x_abs_range_ = info.GetAbsMaximum(ABS_X) - x_abs_min_ + 1; |
| 51 y_abs_min_ = info.GetAbsMinimum(ABS_Y); | 52 y_abs_min_ = info.GetAbsMinimum(ABS_Y); |
| 52 y_abs_range_ = info.GetAbsMaximum(ABS_Y) - y_abs_min_ + 1; | 53 y_abs_range_ = info.GetAbsMaximum(ABS_Y) - y_abs_min_ + 1; |
| 53 tilt_x_min_ = info.GetAbsMinimum(ABS_TILT_X); | 54 tilt_x_min_ = info.GetAbsMinimum(ABS_TILT_X); |
| 54 tilt_y_min_ = info.GetAbsMinimum(ABS_TILT_Y); | 55 tilt_y_min_ = info.GetAbsMinimum(ABS_TILT_Y); |
| 55 tilt_x_range_ = info.GetAbsMaximum(ABS_TILT_X) - tilt_x_min_ + 1; | 56 tilt_x_range_ = info.GetAbsMaximum(ABS_TILT_X) - tilt_x_min_ + 1; |
| 56 tilt_y_range_ = info.GetAbsMaximum(ABS_TILT_Y) - tilt_y_min_ + 1; | 57 tilt_y_range_ = info.GetAbsMaximum(ABS_TILT_Y) - tilt_y_min_ + 1; |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 input_device_.id, EF_NONE, cursor_->GetLocation(), | 212 input_device_.id, EF_NONE, cursor_->GetLocation(), |
| 212 PointerDetails(GetToolType(stylus_), | 213 PointerDetails(GetToolType(stylus_), |
| 213 /* radius_x */ 0.0f, /* radius_y */ 0.0f, pressure_, | 214 /* radius_x */ 0.0f, /* radius_y */ 0.0f, pressure_, |
| 214 tilt_x_, tilt_y_), | 215 tilt_x_, tilt_y_), |
| 215 TimeTicksFromInputEvent(input))); | 216 TimeTicksFromInputEvent(input))); |
| 216 | 217 |
| 217 abs_value_dirty_ = false; | 218 abs_value_dirty_ = false; |
| 218 } | 219 } |
| 219 | 220 |
| 220 } // namespace ui | 221 } // namespace ui |
| OLD | NEW |