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

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

Issue 1037843003: ozone: evdev: Allow setting slot values in EventDeviceInfo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: define ABS_MT_TOOL_Y if missing 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
« no previous file with comments | « ui/events/ozone/evdev/event_device_test_util.cc ('k') | no next file » | 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 y_num_tuxels_ -= cal.bezel_top + cal.bezel_bottom; 103 y_num_tuxels_ -= cal.bezel_top + cal.bezel_bottom;
104 104
105 VLOG(1) << "applying touch calibration: " 105 VLOG(1) << "applying touch calibration: "
106 << base::StringPrintf("[%d, %d, %d, %d]", cal.bezel_left, 106 << base::StringPrintf("[%d, %d, %d, %d]", cal.bezel_left,
107 cal.bezel_right, cal.bezel_top, 107 cal.bezel_right, cal.bezel_top,
108 cal.bezel_bottom); 108 cal.bezel_bottom);
109 } 109 }
110 110
111 events_.resize(touch_points_); 111 events_.resize(touch_points_);
112 for (size_t i = 0; i < events_.size(); ++i) { 112 for (size_t i = 0; i < events_.size(); ++i) {
113 events_[i].x = info.GetSlotValue(ABS_MT_POSITION_X, i); 113 events_[i].x = info.GetAbsMtSlotValue(ABS_MT_POSITION_X, i);
114 events_[i].y = info.GetSlotValue(ABS_MT_POSITION_Y, i); 114 events_[i].y = info.GetAbsMtSlotValue(ABS_MT_POSITION_Y, i);
115 events_[i].tracking_id = info.GetSlotValue(ABS_MT_TRACKING_ID, i); 115 events_[i].tracking_id = info.GetAbsMtSlotValue(ABS_MT_TRACKING_ID, i);
116 events_[i].touching = (events_[i].tracking_id >= 0); 116 events_[i].touching = (events_[i].tracking_id >= 0);
117 events_[i].slot = i; 117 events_[i].slot = i;
118 events_[i].radius_x = info.GetSlotValue(ABS_MT_TOUCH_MAJOR, i); 118
119 events_[i].radius_y = info.GetSlotValue(ABS_MT_TOUCH_MINOR, i); 119 // Optional bits.
120 events_[i].pressure = info.GetSlotValue(ABS_MT_PRESSURE, i); 120 events_[i].radius_x =
121 info.GetAbsMtSlotValueWithDefault(ABS_MT_TOUCH_MAJOR, i, 0);
122 events_[i].radius_y =
123 info.GetAbsMtSlotValueWithDefault(ABS_MT_TOUCH_MINOR, i, 0);
124 events_[i].pressure =
125 info.GetAbsMtSlotValueWithDefault(ABS_MT_PRESSURE, i, 0);
121 } 126 }
122 } 127 }
123 128
124 bool TouchEventConverterEvdev::Reinitialize() { 129 bool TouchEventConverterEvdev::Reinitialize() {
125 EventDeviceInfo info; 130 EventDeviceInfo info;
126 if (info.Initialize(fd_)) { 131 if (info.Initialize(fd_)) {
127 Initialize(info); 132 Initialize(info);
128 return true; 133 return true;
129 } 134 }
130 return false; 135 return false;
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 303
299 if (event_type != ET_UNKNOWN) 304 if (event_type != ET_UNKNOWN)
300 ReportEvent(*event, event_type, delta); 305 ReportEvent(*event, event_type, delta);
301 306
302 event->was_touching = event->touching; 307 event->was_touching = event->touching;
303 event->altered = false; 308 event->altered = false;
304 } 309 }
305 } 310 }
306 311
307 } // namespace ui 312 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/ozone/evdev/event_device_test_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698