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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 | 351 |
352 if (touch.touching) | 352 if (touch.touching) |
353 return touch.was_touching ? ET_TOUCH_MOVED : ET_TOUCH_PRESSED; | 353 return touch.was_touching ? ET_TOUCH_MOVED : ET_TOUCH_PRESSED; |
354 return touch.was_touching ? ET_TOUCH_RELEASED : ET_UNKNOWN; | 354 return touch.was_touching ? ET_TOUCH_RELEASED : ET_UNKNOWN; |
355 } | 355 } |
356 | 356 |
357 void TouchEventConverterEvdev::ReportEvent(const InProgressTouchEvdev& event, | 357 void TouchEventConverterEvdev::ReportEvent(const InProgressTouchEvdev& event, |
358 EventType event_type, | 358 EventType event_type, |
359 const base::TimeDelta& timestamp) { | 359 const base::TimeDelta& timestamp) { |
360 dispatcher_->DispatchTouchEvent(TouchEventParams( | 360 dispatcher_->DispatchTouchEvent(TouchEventParams( |
361 id_, event.slot, event_type, gfx::PointF(event.x, event.y), | 361 input_device_.id, event.slot, event_type, gfx::PointF(event.x, event.y), |
362 gfx::Vector2dF(event.radius_x, event.radius_y), event.pressure, | 362 gfx::Vector2dF(event.radius_x, event.radius_y), event.pressure, |
363 timestamp)); | 363 timestamp)); |
364 } | 364 } |
365 | 365 |
366 void TouchEventConverterEvdev::ReportEvents(base::TimeDelta delta) { | 366 void TouchEventConverterEvdev::ReportEvents(base::TimeDelta delta) { |
367 if (touch_noise_finder_) | 367 if (touch_noise_finder_) |
368 touch_noise_finder_->HandleTouches(events_, delta); | 368 touch_noise_finder_->HandleTouches(events_, delta); |
369 | 369 |
370 for (size_t i = 0; i < events_.size(); i++) { | 370 for (size_t i = 0; i < events_.size(); i++) { |
371 InProgressTouchEvdev* event = &events_[i]; | 371 InProgressTouchEvdev* event = &events_[i]; |
(...skipping 17 matching lines...) Expand all Loading... |
389 if (pressure_max_ - pressure_min_) | 389 if (pressure_max_ - pressure_min_) |
390 pressure /= pressure_max_ - pressure_min_; | 390 pressure /= pressure_max_ - pressure_min_; |
391 return pressure; | 391 return pressure; |
392 } | 392 } |
393 | 393 |
394 int TouchEventConverterEvdev::NextTrackingId() { | 394 int TouchEventConverterEvdev::NextTrackingId() { |
395 return next_tracking_id_++ & kMaxTrackingId; | 395 return next_tracking_id_++ & kMaxTrackingId; |
396 } | 396 } |
397 | 397 |
398 } // namespace ui | 398 } // namespace ui |
OLD | NEW |