OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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) { | |
rjkroege
2013/11/04 23:39:46
it is possible to get key events on the touchscree
spang
2013/11/05 00:10:02
Yes it happens. Only the BTN_TOUCH "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 |
OLD | NEW |