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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 ssize_t read_size = read(fd, inputs, sizeof(inputs)); | 149 ssize_t read_size = read(fd, inputs, sizeof(inputs)); |
150 if (read_size < 0) { | 150 if (read_size < 0) { |
151 if (errno == EINTR || errno == EAGAIN) | 151 if (errno == EINTR || errno == EAGAIN) |
152 return; | 152 return; |
153 if (errno != ENODEV) | 153 if (errno != ENODEV) |
154 PLOG(ERROR) << "error reading device " << path_.value(); | 154 PLOG(ERROR) << "error reading device " << path_.value(); |
155 Stop(); | 155 Stop(); |
156 return; | 156 return; |
157 } | 157 } |
158 | 158 |
| 159 if (ignore_events_) |
| 160 return; |
| 161 |
159 for (unsigned i = 0; i < read_size / sizeof(*inputs); i++) { | 162 for (unsigned i = 0; i < read_size / sizeof(*inputs); i++) { |
160 ProcessInputEvent(inputs[i]); | 163 ProcessInputEvent(inputs[i]); |
161 } | 164 } |
162 } | 165 } |
163 | 166 |
164 void TouchEventConverterEvdev::ProcessInputEvent(const input_event& input) { | 167 void TouchEventConverterEvdev::ProcessInputEvent(const input_event& input) { |
165 if (input.type == EV_SYN) { | 168 if (input.type == EV_SYN) { |
166 ProcessSyn(input); | 169 ProcessSyn(input); |
167 } else if(syn_dropped_) { | 170 } else if(syn_dropped_) { |
168 // Do nothing. This branch indicates we have lost sync with the driver. | 171 // Do nothing. This branch indicates we have lost sync with the driver. |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 | 304 |
302 // Subsequent events for this finger will be touch-move until it | 305 // Subsequent events for this finger will be touch-move until it |
303 // is released. | 306 // is released. |
304 events_[i].type_ = ET_TOUCH_MOVED; | 307 events_[i].type_ = ET_TOUCH_MOVED; |
305 } | 308 } |
306 } | 309 } |
307 altered_slots_.reset(); | 310 altered_slots_.reset(); |
308 } | 311 } |
309 | 312 |
310 } // namespace ui | 313 } // namespace ui |
OLD | NEW |