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/event_device_info.h" | 5 #include "ui/events/ozone/evdev/event_device_info.h" |
6 | 6 |
7 #include <linux/input.h> | 7 #include <linux/input.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/threading/thread_restrictions.h" | 10 #include "base/threading/thread_restrictions.h" |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 | 230 |
231 // Check first 31 keys: If we have all of them, consider it a full | 231 // Check first 31 keys: If we have all of them, consider it a full |
232 // keyboard. This is exactly what udev does for ID_INPUT_KEYBOARD. | 232 // keyboard. This is exactly what udev does for ID_INPUT_KEYBOARD. |
233 for (int key = KEY_ESC; key <= KEY_D; ++key) | 233 for (int key = KEY_ESC; key <= KEY_D; ++key) |
234 if (!HasKeyEvent(key)) | 234 if (!HasKeyEvent(key)) |
235 return false; | 235 return false; |
236 | 236 |
237 return true; | 237 return true; |
238 } | 238 } |
239 | 239 |
| 240 bool EventDeviceInfo::HasMouse() const { |
| 241 return HasRelXY(); |
| 242 } |
| 243 |
240 bool EventDeviceInfo::HasTouchpad() const { | 244 bool EventDeviceInfo::HasTouchpad() const { |
241 return (HasAbsXY() || HasMTAbsXY()) && !IsMappedToScreen(); | 245 return (HasAbsXY() || HasMTAbsXY()) && !IsMappedToScreen(); |
242 } | 246 } |
243 | 247 |
244 const std::vector<int32_t>& EventDeviceInfo::GetMtSlotsForCode(int code) const { | 248 const std::vector<int32_t>& EventDeviceInfo::GetMtSlotsForCode(int code) const { |
245 int index = code - ABS_MT_SLOT - 1; | 249 int index = code - ABS_MT_SLOT - 1; |
246 DCHECK_LE(0, index) << code << " is not a valid multi-touch code"; | 250 DCHECK_LE(0, index) << code << " is not a valid multi-touch code"; |
247 DCHECK_LT(index, EVDEV_ABS_MT_COUNT) | 251 DCHECK_LT(index, EVDEV_ABS_MT_COUNT) |
248 << code << " is not a valid multi-touch code"; | 252 << code << " is not a valid multi-touch code"; |
249 return slot_values_[index]; | 253 return slot_values_[index]; |
250 } | 254 } |
251 | 255 |
252 } // namespace ui | 256 } // namespace ui |
OLD | NEW |