Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef UI_EVENTS_OZONE_EVDEV_EVENT_DEVICE_INFO_H_ | |
| 6 #define UI_EVENTS_OZONE_EVDEV_EVENT_DEVICE_INFO_H_ | |
| 7 | |
| 8 #include <limits.h> | |
| 9 #include <linux/input.h> | |
| 10 | |
| 11 #include "base/basictypes.h" | |
| 12 | |
| 13 #define EVDEV_LONG_BITS (CHAR_BIT * sizeof(long)) | |
| 14 #define EVDEV_BITS_TO_LONGS(x) (((x) + EVDEV_LONG_BITS - 1) / EVDEV_LONG_BITS) | |
| 15 | |
| 16 namespace ui { | |
| 17 | |
| 18 class EventDeviceInfo { | |
|
rjkroege
2013/11/04 23:39:46
a class doc?
spang
2013/11/05 00:10:02
Done.
| |
| 19 public: | |
| 20 EventDeviceInfo(); | |
| 21 ~EventDeviceInfo(); | |
| 22 | |
| 23 // Initialize device information from an open device. | |
| 24 bool Initialize(int fd); | |
| 25 | |
| 26 // Check events this device can generate. | |
| 27 bool HasEventType(unsigned int type) const; | |
| 28 bool HasKeyEvent(unsigned int code) const; | |
| 29 bool HasRelEvent(unsigned int code) const; | |
| 30 bool HasAbsEvent(unsigned int code) const; | |
| 31 bool HasMscEvent(unsigned int code) const; | |
| 32 bool HasSwEvent(unsigned int code) const; | |
| 33 bool hasLedEvent(unsigned int code) const; | |
| 34 | |
| 35 // Check input device properties. | |
| 36 bool HasProp(unsigned int code) const; | |
| 37 | |
| 38 private: | |
| 39 unsigned long ev_bits_[EVDEV_BITS_TO_LONGS(EV_CNT)]; | |
|
rjkroege
2013/11/04 23:39:46
how big are these?
spang
2013/11/05 00:10:02
Whole thing is currently 152 bytes.
This is less
| |
| 40 unsigned long key_bits_[EVDEV_BITS_TO_LONGS(KEY_CNT)]; | |
| 41 unsigned long rel_bits_[EVDEV_BITS_TO_LONGS(REL_CNT)]; | |
| 42 unsigned long abs_bits_[EVDEV_BITS_TO_LONGS(ABS_CNT)]; | |
| 43 unsigned long msc_bits_[EVDEV_BITS_TO_LONGS(MSC_CNT)]; | |
| 44 unsigned long sw_bits_[EVDEV_BITS_TO_LONGS(SW_CNT)]; | |
| 45 unsigned long led_bits_[EVDEV_BITS_TO_LONGS(LED_CNT)]; | |
| 46 unsigned long prop_bits_[EVDEV_BITS_TO_LONGS(INPUT_PROP_CNT)]; | |
| 47 | |
| 48 DISALLOW_COPY_AND_ASSIGN(EventDeviceInfo); | |
| 49 }; | |
| 50 | |
| 51 } // namspace ui | |
| 52 | |
| 53 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_DEVICE_INFO_H_ | |
| OLD | NEW |