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

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

Issue 797483002: ozone: evdev: Populate keyboard list on DeviceDataManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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_info.h ('k') | ui/events/ozone/evdev/event_factory_evdev.h » ('j') | 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/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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 226
227 // Touchpads are not mapped to the screen. 227 // Touchpads are not mapped to the screen.
228 if (HasKeyEvent(BTN_LEFT) || HasKeyEvent(BTN_MIDDLE) || 228 if (HasKeyEvent(BTN_LEFT) || HasKeyEvent(BTN_MIDDLE) ||
229 HasKeyEvent(BTN_RIGHT) || HasKeyEvent(BTN_TOOL_FINGER)) 229 HasKeyEvent(BTN_RIGHT) || HasKeyEvent(BTN_TOOL_FINGER))
230 return false; 230 return false;
231 231
232 // Touchscreens are mapped to the screen. 232 // Touchscreens are mapped to the screen.
233 return true; 233 return true;
234 } 234 }
235 235
236 bool EventDeviceInfo::HasKeyboard() const {
237 if (!HasEventType(EV_KEY))
238 return false;
239
240 // Check first 31 keys: If we have all of them, consider it a full
241 // keyboard. This is exactly what udev does for ID_INPUT_KEYBOARD.
242 for (int key = KEY_ESC; key <= KEY_D; ++key)
sadrul 2014/12/11 15:41:37 {}?
243 if (!HasKeyEvent(key))
244 return false;
245
246 return true;
247 }
248
236 const std::vector<int32_t>& EventDeviceInfo::GetMtSlotsForCode(int code) const { 249 const std::vector<int32_t>& EventDeviceInfo::GetMtSlotsForCode(int code) const {
237 int index = code - ABS_MT_SLOT - 1; 250 int index = code - ABS_MT_SLOT - 1;
238 DCHECK_LE(0, index) << code << " is not a valid multi-touch code"; 251 DCHECK_LE(0, index) << code << " is not a valid multi-touch code";
239 DCHECK_LT(index, EVDEV_ABS_MT_COUNT) 252 DCHECK_LT(index, EVDEV_ABS_MT_COUNT)
240 << code << " is not a valid multi-touch code"; 253 << code << " is not a valid multi-touch code";
241 return slot_values_[index]; 254 return slot_values_[index];
242 } 255 }
243 256
244 } // namespace ui 257 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/ozone/evdev/event_device_info.h ('k') | ui/events/ozone/evdev/event_factory_evdev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698