| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 79 |
| 80 } // namespace | 80 } // namespace |
| 81 | 81 |
| 82 namespace ui { | 82 namespace ui { |
| 83 | 83 |
| 84 TouchEventConverterEvdev::TouchEventConverterEvdev( | 84 TouchEventConverterEvdev::TouchEventConverterEvdev( |
| 85 int fd, | 85 int fd, |
| 86 base::FilePath path, | 86 base::FilePath path, |
| 87 int id, | 87 int id, |
| 88 InputDeviceType type, | 88 InputDeviceType type, |
| 89 const EventDeviceInfo& devinfo, | |
| 90 DeviceEventDispatcherEvdev* dispatcher) | 89 DeviceEventDispatcherEvdev* dispatcher) |
| 91 : EventConverterEvdev(fd, | 90 : EventConverterEvdev(fd, path, id, type), |
| 92 path, | |
| 93 id, | |
| 94 type, | |
| 95 devinfo.name(), | |
| 96 devinfo.vendor_id(), | |
| 97 devinfo.product_id()), | |
| 98 dispatcher_(dispatcher), | 91 dispatcher_(dispatcher), |
| 99 syn_dropped_(false), | 92 syn_dropped_(false), |
| 100 has_mt_(false), | 93 has_mt_(false), |
| 101 touch_points_(0), | 94 touch_points_(0), |
| 102 next_tracking_id_(0), | 95 next_tracking_id_(0), |
| 103 current_slot_(0) { | 96 current_slot_(0) { |
| 104 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 97 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 105 switches::kExtraTouchNoiseFiltering)) { | 98 switches::kExtraTouchNoiseFiltering)) { |
| 106 touch_noise_finder_.reset(new TouchNoiseFinder); | 99 touch_noise_finder_.reset(new TouchNoiseFinder); |
| 107 } | 100 } |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 | 354 |
| 362 if (touch.touching) | 355 if (touch.touching) |
| 363 return touch.was_touching ? ET_TOUCH_MOVED : ET_TOUCH_PRESSED; | 356 return touch.was_touching ? ET_TOUCH_MOVED : ET_TOUCH_PRESSED; |
| 364 return touch.was_touching ? ET_TOUCH_RELEASED : ET_UNKNOWN; | 357 return touch.was_touching ? ET_TOUCH_RELEASED : ET_UNKNOWN; |
| 365 } | 358 } |
| 366 | 359 |
| 367 void TouchEventConverterEvdev::ReportEvent(const InProgressTouchEvdev& event, | 360 void TouchEventConverterEvdev::ReportEvent(const InProgressTouchEvdev& event, |
| 368 EventType event_type, | 361 EventType event_type, |
| 369 const base::TimeDelta& timestamp) { | 362 const base::TimeDelta& timestamp) { |
| 370 dispatcher_->DispatchTouchEvent(TouchEventParams( | 363 dispatcher_->DispatchTouchEvent(TouchEventParams( |
| 371 input_device_.id, event.slot, event_type, gfx::PointF(event.x, event.y), | 364 id_, event.slot, event_type, gfx::PointF(event.x, event.y), |
| 372 gfx::Vector2dF(event.radius_x, event.radius_y), event.pressure, | 365 gfx::Vector2dF(event.radius_x, event.radius_y), event.pressure, |
| 373 timestamp)); | 366 timestamp)); |
| 374 } | 367 } |
| 375 | 368 |
| 376 void TouchEventConverterEvdev::ReportEvents(base::TimeDelta delta) { | 369 void TouchEventConverterEvdev::ReportEvents(base::TimeDelta delta) { |
| 377 if (touch_noise_finder_) | 370 if (touch_noise_finder_) |
| 378 touch_noise_finder_->HandleTouches(events_, delta); | 371 touch_noise_finder_->HandleTouches(events_, delta); |
| 379 | 372 |
| 380 for (size_t i = 0; i < events_.size(); i++) { | 373 for (size_t i = 0; i < events_.size(); i++) { |
| 381 InProgressTouchEvdev* event = &events_[i]; | 374 InProgressTouchEvdev* event = &events_[i]; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 if (pressure_max_ - pressure_min_) | 413 if (pressure_max_ - pressure_min_) |
| 421 pressure /= pressure_max_ - pressure_min_; | 414 pressure /= pressure_max_ - pressure_min_; |
| 422 return pressure; | 415 return pressure; |
| 423 } | 416 } |
| 424 | 417 |
| 425 int TouchEventConverterEvdev::NextTrackingId() { | 418 int TouchEventConverterEvdev::NextTrackingId() { |
| 426 return next_tracking_id_++ & kMaxTrackingId; | 419 return next_tracking_id_++ & kMaxTrackingId; |
| 427 } | 420 } |
| 428 | 421 |
| 429 } // namespace ui | 422 } // namespace ui |
| OLD | NEW |