| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 73 |
| 74 TouchEventConverterEvdev::TouchEventConverterEvdev( | 74 TouchEventConverterEvdev::TouchEventConverterEvdev( |
| 75 int fd, | 75 int fd, |
| 76 base::FilePath path, | 76 base::FilePath path, |
| 77 int id, | 77 int id, |
| 78 InputDeviceType type, | 78 InputDeviceType type, |
| 79 DeviceEventDispatcherEvdev* dispatcher) | 79 DeviceEventDispatcherEvdev* dispatcher) |
| 80 : EventConverterEvdev(fd, path, id, type), | 80 : EventConverterEvdev(fd, path, id, type), |
| 81 dispatcher_(dispatcher), | 81 dispatcher_(dispatcher), |
| 82 syn_dropped_(false), | 82 syn_dropped_(false), |
| 83 is_type_a_(false), | |
| 84 touch_points_(0), | 83 touch_points_(0), |
| 85 current_slot_(0) { | 84 current_slot_(0) { |
| 86 } | 85 } |
| 87 | 86 |
| 88 TouchEventConverterEvdev::~TouchEventConverterEvdev() { | 87 TouchEventConverterEvdev::~TouchEventConverterEvdev() { |
| 89 Stop(); | 88 Stop(); |
| 90 close(fd_); | 89 close(fd_); |
| 91 } | 90 } |
| 92 | 91 |
| 93 void TouchEventConverterEvdev::Initialize(const EventDeviceInfo& info) { | 92 void TouchEventConverterEvdev::Initialize(const EventDeviceInfo& info) { |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 if (Reinitialize()) { | 247 if (Reinitialize()) { |
| 249 syn_dropped_ = false; | 248 syn_dropped_ = false; |
| 250 for(InProgressEvents& event: events_) | 249 for(InProgressEvents& event: events_) |
| 251 event.altered_ = false; | 250 event.altered_ = false; |
| 252 } else { | 251 } else { |
| 253 LOG(ERROR) << "failed to re-initialize device info"; | 252 LOG(ERROR) << "failed to re-initialize device info"; |
| 254 } | 253 } |
| 255 } else { | 254 } else { |
| 256 ReportEvents(EventConverterEvdev::TimeDeltaFromInputEvent(input)); | 255 ReportEvents(EventConverterEvdev::TimeDeltaFromInputEvent(input)); |
| 257 } | 256 } |
| 258 if (is_type_a_) | |
| 259 current_slot_ = 0; | |
| 260 break; | |
| 261 case SYN_MT_REPORT: | |
| 262 // For type A devices, we just get a stream of all current contacts, | |
| 263 // in some arbitrary order. | |
| 264 events_[current_slot_].type_ = ET_TOUCH_PRESSED; | |
| 265 if (events_.size() - 1 > current_slot_) | |
| 266 current_slot_++; | |
| 267 is_type_a_ = true; | |
| 268 break; | 257 break; |
| 269 case SYN_DROPPED: | 258 case SYN_DROPPED: |
| 270 // Some buffer has overrun. We ignore all events up to and | 259 // Some buffer has overrun. We ignore all events up to and |
| 271 // including the next SYN_REPORT. | 260 // including the next SYN_REPORT. |
| 272 syn_dropped_ = true; | 261 syn_dropped_ = true; |
| 273 break; | 262 break; |
| 274 default: | 263 default: |
| 275 NOTIMPLEMENTED() << "invalid code for EV_SYN: " << input.code; | 264 NOTIMPLEMENTED() << "invalid code for EV_SYN: " << input.code; |
| 276 } | 265 } |
| 277 } | 266 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 292 | 281 |
| 293 // Subsequent events for this finger will be touch-move until it | 282 // Subsequent events for this finger will be touch-move until it |
| 294 // is released. | 283 // is released. |
| 295 events_[i].type_ = ET_TOUCH_MOVED; | 284 events_[i].type_ = ET_TOUCH_MOVED; |
| 296 events_[i].altered_ = false; | 285 events_[i].altered_ = false; |
| 297 } | 286 } |
| 298 } | 287 } |
| 299 } | 288 } |
| 300 | 289 |
| 301 } // namespace ui | 290 } // namespace ui |
| OLD | NEW |