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