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

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

Issue 671723002: [Ozone] Properly initialize multitouch slot values (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 6 years, 2 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/touch_event_converter_evdev.h ('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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } 65 }
66 66
67 float TuxelToPixelSize(float val, float num_tuxels, float num_pixels) { 67 float TuxelToPixelSize(float val, float num_tuxels, float num_pixels) {
68 return val * num_pixels / num_tuxels; 68 return val * num_pixels / num_tuxels;
69 } 69 }
70 70
71 } // namespace 71 } // namespace
72 72
73 namespace ui { 73 namespace ui {
74 74
75 TouchEventConverterEvdev::InProgressEvents::InProgressEvents()
76 : x_(0),
77 y_(0),
78 id_(-1),
79 finger_(-1),
80 type_(ET_UNKNOWN),
81 radius_x_(0),
82 radius_y_(0),
83 pressure_(0) {
84 }
85
75 TouchEventConverterEvdev::TouchEventConverterEvdev( 86 TouchEventConverterEvdev::TouchEventConverterEvdev(
76 int fd, 87 int fd,
77 base::FilePath path, 88 base::FilePath path,
78 int id, 89 int id,
79 const EventDeviceInfo& info, 90 const EventDeviceInfo& info,
80 const EventDispatchCallback& callback) 91 const EventDispatchCallback& callback)
81 : EventConverterEvdev(fd, path, id), 92 : EventConverterEvdev(fd, path, id),
82 callback_(callback), 93 callback_(callback),
83 syn_dropped_(false), 94 syn_dropped_(false),
84 is_type_a_(false), 95 is_type_a_(false),
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 x_num_tuxels_ -= cal.bezel_left + cal.bezel_right; 133 x_num_tuxels_ -= cal.bezel_left + cal.bezel_right;
123 y_min_tuxels_ += cal.bezel_top; 134 y_min_tuxels_ += cal.bezel_top;
124 y_num_tuxels_ -= cal.bezel_top + cal.bezel_bottom; 135 y_num_tuxels_ -= cal.bezel_top + cal.bezel_bottom;
125 136
126 VLOG(1) << "applying touch calibration: " 137 VLOG(1) << "applying touch calibration: "
127 << base::StringPrintf("[%d, %d, %d, %d]", 138 << base::StringPrintf("[%d, %d, %d, %d]",
128 cal.bezel_left, 139 cal.bezel_left,
129 cal.bezel_right, 140 cal.bezel_right,
130 cal.bezel_top, 141 cal.bezel_top,
131 cal.bezel_bottom); 142 cal.bezel_bottom);
143
144 for (int i = 0;
145 i < std::min<int>(info.GetAbsMaximum(ABS_MT_SLOT) + 1, MAX_FINGERS);
146 ++i) {
147 events_[i].finger_ = info.GetSlotValue(ABS_MT_TRACKING_ID, i);
148 events_[i].type_ =
149 events_[i].finger_ < 0 ? ET_TOUCH_RELEASED : ET_TOUCH_PRESSED;
150 events_[i].x_ = info.GetSlotValue(ABS_MT_POSITION_X, i);
151 events_[i].y_ = info.GetSlotValue(ABS_MT_POSITION_Y, i);
152 events_[i].radius_x_ = info.GetSlotValue(ABS_MT_TOUCH_MAJOR, i);
153 events_[i].radius_y_ = info.GetSlotValue(ABS_MT_TOUCH_MINOR, i);
154 events_[i].pressure_ = info.GetSlotValue(ABS_MT_PRESSURE, i);
155 }
132 } 156 }
133 157
134 bool TouchEventConverterEvdev::Reinitialize() { 158 bool TouchEventConverterEvdev::Reinitialize() {
135 EventDeviceInfo info; 159 EventDeviceInfo info;
136 if (info.Initialize(fd_)) { 160 if (info.Initialize(fd_)) {
137 Init(info); 161 Init(info);
138 return true; 162 return true;
139 } 163 }
140 return false; 164 return false;
141 } 165 }
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 317
294 // Subsequent events for this finger will be touch-move until it 318 // Subsequent events for this finger will be touch-move until it
295 // is released. 319 // is released.
296 events_[i].type_ = ET_TOUCH_MOVED; 320 events_[i].type_ = ET_TOUCH_MOVED;
297 } 321 }
298 } 322 }
299 altered_slots_.reset(); 323 altered_slots_.reset();
300 } 324 }
301 325
302 } // namespace ui 326 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/ozone/evdev/touch_event_converter_evdev.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698