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

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

Issue 58473003: evdev: Fix crashing with touch devices (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « ui/events/ozone/evdev/event_factory.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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.h" 5 #include "ui/events/ozone/evdev/touch_event_converter.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <linux/input.h> 8 #include <linux/input.h>
9 #include <poll.h> 9 #include <poll.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 case ABS_PRESSURE: 139 case ABS_PRESSURE:
140 altered_slots_.set(current_slot_); 140 altered_slots_.set(current_slot_);
141 events_[current_slot_].pressure_ = input.value - pressure_min_; 141 events_[current_slot_].pressure_ = input.value - pressure_min_;
142 events_[current_slot_].pressure_ /= pressure_max_ - pressure_min_; 142 events_[current_slot_].pressure_ /= pressure_max_ - pressure_min_;
143 break; 143 break;
144 case ABS_MT_SLOT: 144 case ABS_MT_SLOT:
145 current_slot_ = input.value; 145 current_slot_ = input.value;
146 altered_slots_.set(current_slot_); 146 altered_slots_.set(current_slot_);
147 break; 147 break;
148 default: 148 default:
149 NOTREACHED(); 149 NOTREACHED() << "invalid code for EV_ABS: " << input.code;
150 } 150 }
151 } else if (input.type == EV_SYN) { 151 } else if (input.type == EV_SYN) {
152 switch (input.code) { 152 switch (input.code) {
153 case SYN_REPORT: 153 case SYN_REPORT:
154 for (int j = 0; j < MAX_FINGERS; j++) { 154 for (int j = 0; j < MAX_FINGERS; j++) {
155 if (altered_slots_[j]) { 155 if (altered_slots_[j]) {
156 // TODO(rjkroege): Support elliptical finger regions. 156 // TODO(rjkroege): Support elliptical finger regions.
157 scoped_ptr<TouchEvent> tev(new TouchEvent( 157 scoped_ptr<TouchEvent> tev(new TouchEvent(
158 events_[j].type_, 158 events_[j].type_,
159 gfx::Point(std::min(x_max_, events_[j].x_), 159 gfx::Point(std::min(x_max_, events_[j].x_),
(...skipping 11 matching lines...) Expand all
171 // Subsequent events for this finger will be touch-move until it 171 // Subsequent events for this finger will be touch-move until it
172 // is released. 172 // is released.
173 events_[j].type_ = ET_TOUCH_MOVED; 173 events_[j].type_ = ET_TOUCH_MOVED;
174 } 174 }
175 } 175 }
176 altered_slots_.reset(); 176 altered_slots_.reset();
177 break; 177 break;
178 case SYN_MT_REPORT: 178 case SYN_MT_REPORT:
179 case SYN_CONFIG: 179 case SYN_CONFIG:
180 case SYN_DROPPED: 180 case SYN_DROPPED:
181 NOTREACHED() << "SYN_MT events not supported."; 181 NOTREACHED() << "invalid code for EV_SYN: " << input.code;
182 break; 182 break;
183 } 183 }
184 } else if (input.type == EV_KEY) {
185 switch (input.code) {
186 case BTN_TOUCH:
187 break;
188 default:
189 NOTREACHED() << "invalid code for EV_KEY: " << input.code;
190 }
184 } else { 191 } else {
185 NOTREACHED(); 192 NOTREACHED() << "invalid type: " << input.type;
186 } 193 }
187 } 194 }
188 } 195 }
189 196
190 } // namespace ui 197 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/ozone/evdev/event_factory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698