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 #ifndef UI_EVENTS_OZONE_EVDEV_EVENT_DEVICE_INFO_H_ | 5 #ifndef UI_EVENTS_OZONE_EVDEV_EVENT_DEVICE_INFO_H_ |
6 #define UI_EVENTS_OZONE_EVDEV_EVENT_DEVICE_INFO_H_ | 6 #define UI_EVENTS_OZONE_EVDEV_EVENT_DEVICE_INFO_H_ |
7 | 7 |
8 #include <limits.h> | 8 #include <limits.h> |
9 #include <linux/input.h> | 9 #include <linux/input.h> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" | 12 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" |
13 | 13 |
14 #define EVDEV_LONG_BITS (CHAR_BIT * sizeof(long)) | 14 #define EVDEV_LONG_BITS (CHAR_BIT * sizeof(long)) |
15 #define EVDEV_BITS_TO_LONGS(x) (((x) + EVDEV_LONG_BITS - 1) / EVDEV_LONG_BITS) | 15 #define EVDEV_BITS_TO_LONGS(x) (((x) + EVDEV_LONG_BITS - 1) / EVDEV_LONG_BITS) |
16 | 16 |
17 namespace ui { | 17 namespace ui { |
18 | 18 |
19 // Device information for Linux input devices | 19 // Device information for Linux input devices |
20 // | 20 // |
21 // This stores and queries information about input devices; in | 21 // This stores and queries information about input devices; in |
22 // particular it knows which events the device can generate. | 22 // particular it knows which events the device can generate. |
23 class EVENTS_OZONE_EVDEV_EXPORT EventDeviceInfo { | 23 class EVENTS_OZONE_EVDEV_EXPORT EventDeviceInfo { |
24 public: | 24 public: |
25 EventDeviceInfo(); | 25 EventDeviceInfo(int id); |
26 ~EventDeviceInfo(); | 26 ~EventDeviceInfo(); |
27 | 27 |
28 int id() const { return id_; } | |
spang
2014/09/29 23:54:35
This doesn't belong here - it isn't related to the
dnicoara
2014/09/30 18:23:27
Done.
| |
29 | |
28 // Initialize device information from an open device. | 30 // Initialize device information from an open device. |
29 bool Initialize(int fd); | 31 bool Initialize(int fd); |
30 | 32 |
31 // Check events this device can generate. | 33 // Check events this device can generate. |
32 bool HasEventType(unsigned int type) const; | 34 bool HasEventType(unsigned int type) const; |
33 bool HasKeyEvent(unsigned int code) const; | 35 bool HasKeyEvent(unsigned int code) const; |
34 bool HasRelEvent(unsigned int code) const; | 36 bool HasRelEvent(unsigned int code) const; |
35 bool HasAbsEvent(unsigned int code) const; | 37 bool HasAbsEvent(unsigned int code) const; |
36 bool HasMscEvent(unsigned int code) const; | 38 bool HasMscEvent(unsigned int code) const; |
37 bool HasSwEvent(unsigned int code) const; | 39 bool HasSwEvent(unsigned int code) const; |
(...skipping 10 matching lines...) Expand all Loading... | |
48 bool HasAbsXY() const; | 50 bool HasAbsXY() const; |
49 | 51 |
50 // Has relativeX & Y axes. | 52 // Has relativeX & Y axes. |
51 bool HasRelXY() const; | 53 bool HasRelXY() const; |
52 | 54 |
53 // Determine whether absolute device X/Y coordinates are mapped onto the | 55 // Determine whether absolute device X/Y coordinates are mapped onto the |
54 // screen. This is the case for touchscreens and tablets but not touchpads. | 56 // screen. This is the case for touchscreens and tablets but not touchpads. |
55 bool IsMappedToScreen() const; | 57 bool IsMappedToScreen() const; |
56 | 58 |
57 private: | 59 private: |
60 int id_; | |
58 unsigned long ev_bits_[EVDEV_BITS_TO_LONGS(EV_CNT)]; | 61 unsigned long ev_bits_[EVDEV_BITS_TO_LONGS(EV_CNT)]; |
59 unsigned long key_bits_[EVDEV_BITS_TO_LONGS(KEY_CNT)]; | 62 unsigned long key_bits_[EVDEV_BITS_TO_LONGS(KEY_CNT)]; |
60 unsigned long rel_bits_[EVDEV_BITS_TO_LONGS(REL_CNT)]; | 63 unsigned long rel_bits_[EVDEV_BITS_TO_LONGS(REL_CNT)]; |
61 unsigned long abs_bits_[EVDEV_BITS_TO_LONGS(ABS_CNT)]; | 64 unsigned long abs_bits_[EVDEV_BITS_TO_LONGS(ABS_CNT)]; |
62 unsigned long msc_bits_[EVDEV_BITS_TO_LONGS(MSC_CNT)]; | 65 unsigned long msc_bits_[EVDEV_BITS_TO_LONGS(MSC_CNT)]; |
63 unsigned long sw_bits_[EVDEV_BITS_TO_LONGS(SW_CNT)]; | 66 unsigned long sw_bits_[EVDEV_BITS_TO_LONGS(SW_CNT)]; |
64 unsigned long led_bits_[EVDEV_BITS_TO_LONGS(LED_CNT)]; | 67 unsigned long led_bits_[EVDEV_BITS_TO_LONGS(LED_CNT)]; |
65 unsigned long prop_bits_[EVDEV_BITS_TO_LONGS(INPUT_PROP_CNT)]; | 68 unsigned long prop_bits_[EVDEV_BITS_TO_LONGS(INPUT_PROP_CNT)]; |
66 | 69 |
67 struct input_absinfo abs_info_[ABS_CNT]; | 70 struct input_absinfo abs_info_[ABS_CNT]; |
68 | 71 |
69 DISALLOW_COPY_AND_ASSIGN(EventDeviceInfo); | 72 DISALLOW_COPY_AND_ASSIGN(EventDeviceInfo); |
70 }; | 73 }; |
71 | 74 |
72 } // namspace ui | 75 } // namspace ui |
73 | 76 |
74 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_DEVICE_INFO_H_ | 77 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_DEVICE_INFO_H_ |
OLD | NEW |