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

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

Issue 1073573002: Ozone support for device special cases in keyboard event rewriting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix crash (thanks spang) Created 5 years, 8 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
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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
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,
89 DeviceEventDispatcherEvdev* dispatcher) 90 DeviceEventDispatcherEvdev* dispatcher)
90 : EventConverterEvdev(fd, path, id, type), 91 : EventConverterEvdev(fd,
92 path,
93 id,
94 type,
95 devinfo.name(),
96 devinfo.vendor_id(),
97 devinfo.product_id()),
91 dispatcher_(dispatcher), 98 dispatcher_(dispatcher),
92 syn_dropped_(false), 99 syn_dropped_(false),
93 has_mt_(false), 100 has_mt_(false),
94 touch_points_(0), 101 touch_points_(0),
95 next_tracking_id_(0), 102 next_tracking_id_(0),
96 current_slot_(0) { 103 current_slot_(0) {
97 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 104 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
98 switches::kExtraTouchNoiseFiltering)) { 105 switches::kExtraTouchNoiseFiltering)) {
99 touch_noise_finder_.reset(new TouchNoiseFinder); 106 touch_noise_finder_.reset(new TouchNoiseFinder);
100 } 107 }
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 361
355 if (touch.touching) 362 if (touch.touching)
356 return touch.was_touching ? ET_TOUCH_MOVED : ET_TOUCH_PRESSED; 363 return touch.was_touching ? ET_TOUCH_MOVED : ET_TOUCH_PRESSED;
357 return touch.was_touching ? ET_TOUCH_RELEASED : ET_UNKNOWN; 364 return touch.was_touching ? ET_TOUCH_RELEASED : ET_UNKNOWN;
358 } 365 }
359 366
360 void TouchEventConverterEvdev::ReportEvent(const InProgressTouchEvdev& event, 367 void TouchEventConverterEvdev::ReportEvent(const InProgressTouchEvdev& event,
361 EventType event_type, 368 EventType event_type,
362 const base::TimeDelta& timestamp) { 369 const base::TimeDelta& timestamp) {
363 dispatcher_->DispatchTouchEvent(TouchEventParams( 370 dispatcher_->DispatchTouchEvent(TouchEventParams(
364 id_, event.slot, event_type, gfx::PointF(event.x, event.y), 371 input_device_.id, event.slot, event_type, gfx::PointF(event.x, event.y),
365 gfx::Vector2dF(event.radius_x, event.radius_y), event.pressure, 372 gfx::Vector2dF(event.radius_x, event.radius_y), event.pressure,
366 timestamp)); 373 timestamp));
367 } 374 }
368 375
369 void TouchEventConverterEvdev::ReportEvents(base::TimeDelta delta) { 376 void TouchEventConverterEvdev::ReportEvents(base::TimeDelta delta) {
370 if (touch_noise_finder_) 377 if (touch_noise_finder_)
371 touch_noise_finder_->HandleTouches(events_, delta); 378 touch_noise_finder_->HandleTouches(events_, delta);
372 379
373 for (size_t i = 0; i < events_.size(); i++) { 380 for (size_t i = 0; i < events_.size(); i++) {
374 InProgressTouchEvdev* event = &events_[i]; 381 InProgressTouchEvdev* event = &events_[i];
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 if (pressure_max_ - pressure_min_) 420 if (pressure_max_ - pressure_min_)
414 pressure /= pressure_max_ - pressure_min_; 421 pressure /= pressure_max_ - pressure_min_;
415 return pressure; 422 return pressure;
416 } 423 }
417 424
418 int TouchEventConverterEvdev::NextTrackingId() { 425 int TouchEventConverterEvdev::NextTrackingId() {
419 return next_tracking_id_++ & kMaxTrackingId; 426 return next_tracking_id_++ & kMaxTrackingId;
420 } 427 }
421 428
422 } // namespace ui 429 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/ozone/evdev/touch_event_converter_evdev.h ('k') | 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