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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 76 |
77 } // namespace | 77 } // namespace |
78 | 78 |
79 namespace ui { | 79 namespace ui { |
80 | 80 |
81 TouchEventConverterEvdev::TouchEventConverterEvdev( | 81 TouchEventConverterEvdev::TouchEventConverterEvdev( |
82 int fd, | 82 int fd, |
83 base::FilePath path, | 83 base::FilePath path, |
84 int id, | 84 int id, |
85 InputDeviceType type, | 85 InputDeviceType type, |
| 86 const EventDeviceInfo& devinfo, |
86 DeviceEventDispatcherEvdev* dispatcher) | 87 DeviceEventDispatcherEvdev* dispatcher) |
87 : EventConverterEvdev(fd, path, id, type), | 88 : EventConverterEvdev(fd, |
| 89 path, |
| 90 id, |
| 91 type, |
| 92 devinfo.name(), |
| 93 devinfo.vendor_id(), |
| 94 devinfo.product_id()), |
88 dispatcher_(dispatcher), | 95 dispatcher_(dispatcher), |
89 syn_dropped_(false), | 96 syn_dropped_(false), |
90 has_mt_(false), | 97 has_mt_(false), |
91 touch_points_(0), | 98 touch_points_(0), |
92 next_tracking_id_(0), | 99 next_tracking_id_(0), |
93 current_slot_(0) { | 100 current_slot_(0) { |
94 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 101 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
95 switches::kExtraTouchNoiseFiltering)) { | 102 switches::kExtraTouchNoiseFiltering)) { |
96 touch_noise_finder_.reset(new TouchNoiseFinder); | 103 touch_noise_finder_.reset(new TouchNoiseFinder); |
97 } | 104 } |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 | 358 |
352 if (touch.touching) | 359 if (touch.touching) |
353 return touch.was_touching ? ET_TOUCH_MOVED : ET_TOUCH_PRESSED; | 360 return touch.was_touching ? ET_TOUCH_MOVED : ET_TOUCH_PRESSED; |
354 return touch.was_touching ? ET_TOUCH_RELEASED : ET_UNKNOWN; | 361 return touch.was_touching ? ET_TOUCH_RELEASED : ET_UNKNOWN; |
355 } | 362 } |
356 | 363 |
357 void TouchEventConverterEvdev::ReportEvent(const InProgressTouchEvdev& event, | 364 void TouchEventConverterEvdev::ReportEvent(const InProgressTouchEvdev& event, |
358 EventType event_type, | 365 EventType event_type, |
359 const base::TimeDelta& timestamp) { | 366 const base::TimeDelta& timestamp) { |
360 dispatcher_->DispatchTouchEvent(TouchEventParams( | 367 dispatcher_->DispatchTouchEvent(TouchEventParams( |
361 id_, event.slot, event_type, gfx::PointF(event.x, event.y), | 368 input_device_.id, event.slot, event_type, gfx::PointF(event.x, event.y), |
362 gfx::Vector2dF(event.radius_x, event.radius_y), event.pressure, | 369 gfx::Vector2dF(event.radius_x, event.radius_y), event.pressure, |
363 timestamp)); | 370 timestamp)); |
364 } | 371 } |
365 | 372 |
366 void TouchEventConverterEvdev::ReportEvents(base::TimeDelta delta) { | 373 void TouchEventConverterEvdev::ReportEvents(base::TimeDelta delta) { |
367 if (touch_noise_finder_) | 374 if (touch_noise_finder_) |
368 touch_noise_finder_->HandleTouches(events_, delta); | 375 touch_noise_finder_->HandleTouches(events_, delta); |
369 | 376 |
370 for (size_t i = 0; i < events_.size(); i++) { | 377 for (size_t i = 0; i < events_.size(); i++) { |
371 InProgressTouchEvdev* event = &events_[i]; | 378 InProgressTouchEvdev* event = &events_[i]; |
(...skipping 17 matching lines...) Expand all Loading... |
389 if (pressure_max_ - pressure_min_) | 396 if (pressure_max_ - pressure_min_) |
390 pressure /= pressure_max_ - pressure_min_; | 397 pressure /= pressure_max_ - pressure_min_; |
391 return pressure; | 398 return pressure; |
392 } | 399 } |
393 | 400 |
394 int TouchEventConverterEvdev::NextTrackingId() { | 401 int TouchEventConverterEvdev::NextTrackingId() { |
395 return next_tracking_id_++ & kMaxTrackingId; | 402 return next_tracking_id_++ & kMaxTrackingId; |
396 } | 403 } |
397 | 404 |
398 } // namespace ui | 405 } // namespace ui |
OLD | NEW |