Chromium Code Reviews| Index: ui/events/ozone/evdev/event_device_info.h |
| diff --git a/ui/events/ozone/evdev/event_device_info.h b/ui/events/ozone/evdev/event_device_info.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..3a8dde996af5d540189039b56a4e955f60370c21 |
| --- /dev/null |
| +++ b/ui/events/ozone/evdev/event_device_info.h |
| @@ -0,0 +1,53 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef UI_EVENTS_OZONE_EVDEV_EVENT_DEVICE_INFO_H_ |
| +#define UI_EVENTS_OZONE_EVDEV_EVENT_DEVICE_INFO_H_ |
| + |
| +#include <limits.h> |
| +#include <linux/input.h> |
| + |
| +#include "base/basictypes.h" |
| + |
| +#define EVDEV_LONG_BITS (CHAR_BIT * sizeof(long)) |
| +#define EVDEV_BITS_TO_LONGS(x) (((x) + EVDEV_LONG_BITS - 1) / EVDEV_LONG_BITS) |
| + |
| +namespace ui { |
| + |
| +class EventDeviceInfo { |
|
rjkroege
2013/11/04 23:39:46
a class doc?
spang
2013/11/05 00:10:02
Done.
|
| + public: |
| + EventDeviceInfo(); |
| + ~EventDeviceInfo(); |
| + |
| + // Initialize device information from an open device. |
| + bool Initialize(int fd); |
| + |
| + // Check events this device can generate. |
| + bool HasEventType(unsigned int type) const; |
| + bool HasKeyEvent(unsigned int code) const; |
| + bool HasRelEvent(unsigned int code) const; |
| + bool HasAbsEvent(unsigned int code) const; |
| + bool HasMscEvent(unsigned int code) const; |
| + bool HasSwEvent(unsigned int code) const; |
| + bool hasLedEvent(unsigned int code) const; |
| + |
| + // Check input device properties. |
| + bool HasProp(unsigned int code) const; |
| + |
| + private: |
| + 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
|
| + unsigned long key_bits_[EVDEV_BITS_TO_LONGS(KEY_CNT)]; |
| + unsigned long rel_bits_[EVDEV_BITS_TO_LONGS(REL_CNT)]; |
| + unsigned long abs_bits_[EVDEV_BITS_TO_LONGS(ABS_CNT)]; |
| + unsigned long msc_bits_[EVDEV_BITS_TO_LONGS(MSC_CNT)]; |
| + unsigned long sw_bits_[EVDEV_BITS_TO_LONGS(SW_CNT)]; |
| + unsigned long led_bits_[EVDEV_BITS_TO_LONGS(LED_CNT)]; |
| + unsigned long prop_bits_[EVDEV_BITS_TO_LONGS(INPUT_PROP_CNT)]; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(EventDeviceInfo); |
| +}; |
| + |
| +} // namspace ui |
| + |
| +#endif // UI_EVENTS_OZONE_EVDEV_EVENT_DEVICE_INFO_H_ |