Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(535)

Side by Side Diff: ui/events/ozone/evdev/touch_event_converter_evdev.cc

Issue 506303002: ozone: evdev: Fix ghost touches aligned with first touch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add unit test Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ui/events/ozone/evdev/touch_event_converter_evdev_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 NOTIMPLEMENTED() << "invalid type: " << input.type; 196 NOTIMPLEMENTED() << "invalid type: " << input.type;
197 } 197 }
198 } 198 }
199 199
200 void TouchEventConverterEvdev::ProcessAbs(const input_event& input) { 200 void TouchEventConverterEvdev::ProcessAbs(const input_event& input) {
201 switch (input.code) { 201 switch (input.code) {
202 case ABS_MT_TOUCH_MAJOR: 202 case ABS_MT_TOUCH_MAJOR:
203 altered_slots_.set(current_slot_); 203 altered_slots_.set(current_slot_);
204 events_[current_slot_].major_ = input.value; 204 events_[current_slot_].major_ = input.value;
205 break; 205 break;
206 case ABS_X:
207 case ABS_MT_POSITION_X: 206 case ABS_MT_POSITION_X:
208 altered_slots_.set(current_slot_); 207 altered_slots_.set(current_slot_);
209 events_[current_slot_].x_ = TuxelsToPixels(input.value, 208 events_[current_slot_].x_ = TuxelsToPixels(input.value,
210 x_min_tuxels_, 209 x_min_tuxels_,
211 x_num_tuxels_, 210 x_num_tuxels_,
212 x_min_pixels_, 211 x_min_pixels_,
213 x_num_pixels_); 212 x_num_pixels_);
214 break; 213 break;
215 case ABS_Y:
216 case ABS_MT_POSITION_Y: 214 case ABS_MT_POSITION_Y:
217 altered_slots_.set(current_slot_); 215 altered_slots_.set(current_slot_);
218 events_[current_slot_].y_ = TuxelsToPixels(input.value, 216 events_[current_slot_].y_ = TuxelsToPixels(input.value,
219 y_min_tuxels_, 217 y_min_tuxels_,
220 y_num_tuxels_, 218 y_num_tuxels_,
221 y_min_pixels_, 219 y_min_pixels_,
222 y_num_pixels_); 220 y_num_pixels_);
223 break; 221 break;
224 case ABS_MT_TRACKING_ID: 222 case ABS_MT_TRACKING_ID:
225 altered_slots_.set(current_slot_); 223 altered_slots_.set(current_slot_);
226 if (input.value < 0) { 224 if (input.value < 0) {
227 events_[current_slot_].type_ = ET_TOUCH_RELEASED; 225 events_[current_slot_].type_ = ET_TOUCH_RELEASED;
228 } else { 226 } else {
229 events_[current_slot_].finger_ = input.value; 227 events_[current_slot_].finger_ = input.value;
230 events_[current_slot_].type_ = ET_TOUCH_PRESSED; 228 events_[current_slot_].type_ = ET_TOUCH_PRESSED;
231 } 229 }
232 break; 230 break;
233 case ABS_MT_PRESSURE: 231 case ABS_MT_PRESSURE:
234 case ABS_PRESSURE:
235 altered_slots_.set(current_slot_); 232 altered_slots_.set(current_slot_);
236 events_[current_slot_].pressure_ = input.value - pressure_min_; 233 events_[current_slot_].pressure_ = input.value - pressure_min_;
237 events_[current_slot_].pressure_ /= pressure_max_ - pressure_min_; 234 events_[current_slot_].pressure_ /= pressure_max_ - pressure_min_;
238 break; 235 break;
239 case ABS_MT_SLOT: 236 case ABS_MT_SLOT:
240 current_slot_ = input.value; 237 current_slot_ = input.value;
241 altered_slots_.set(current_slot_); 238 altered_slots_.set(current_slot_);
242 break; 239 break;
243 default: 240 default:
244 NOTIMPLEMENTED() << "invalid code for EV_ABS: " << input.code; 241 DVLOG(5) << "unhandled code for EV_ABS: " << input.code;
245 } 242 }
246 } 243 }
247 244
248 void TouchEventConverterEvdev::ProcessSyn(const input_event& input) { 245 void TouchEventConverterEvdev::ProcessSyn(const input_event& input) {
249 switch (input.code) { 246 switch (input.code) {
250 case SYN_REPORT: 247 case SYN_REPORT:
251 if (syn_dropped_) { 248 if (syn_dropped_) {
252 // Have to re-initialize. 249 // Have to re-initialize.
253 if (Reinitialize()) { 250 if (Reinitialize()) {
254 syn_dropped_ = false; 251 syn_dropped_ = false;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 294
298 // Subsequent events for this finger will be touch-move until it 295 // Subsequent events for this finger will be touch-move until it
299 // is released. 296 // is released.
300 events_[i].type_ = ET_TOUCH_MOVED; 297 events_[i].type_ = ET_TOUCH_MOVED;
301 } 298 }
302 } 299 }
303 altered_slots_.reset(); 300 altered_slots_.reset();
304 } 301 }
305 302
306 } // namespace ui 303 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/events/ozone/evdev/touch_event_converter_evdev_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698