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/event_device_util.h" | 12 #include "ui/events/ozone/evdev/event_device_util.h" |
13 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" | 13 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" |
14 | 14 |
15 // ABS_MT_SLOT isn't valid options for EVIOCGMTSLOTS ioctl. | |
16 #define ABS_MT_COUNT (ABS_MT_TOOL_Y - ABS_MT_SLOT) | |
spang
2014/10/21 19:38:36
This looks deceptively like something that comes f
dnicoara
2014/10/21 20:32:12
Done.
| |
17 | |
15 namespace ui { | 18 namespace ui { |
16 | 19 |
17 // Device information for Linux input devices | 20 // Device information for Linux input devices |
18 // | 21 // |
19 // This stores and queries information about input devices; in | 22 // This stores and queries information about input devices; in |
20 // particular it knows which events the device can generate. | 23 // particular it knows which events the device can generate. |
21 class EVENTS_OZONE_EVDEV_EXPORT EventDeviceInfo { | 24 class EVENTS_OZONE_EVDEV_EXPORT EventDeviceInfo { |
22 public: | 25 public: |
23 EventDeviceInfo(); | 26 EventDeviceInfo(); |
24 ~EventDeviceInfo(); | 27 ~EventDeviceInfo(); |
25 | 28 |
26 // Initialize device information from an open device. | 29 // Initialize device information from an open device. |
27 bool Initialize(int fd); | 30 bool Initialize(int fd); |
28 | 31 |
29 // Check events this device can generate. | 32 // Check events this device can generate. |
30 bool HasEventType(unsigned int type) const; | 33 bool HasEventType(unsigned int type) const; |
31 bool HasKeyEvent(unsigned int code) const; | 34 bool HasKeyEvent(unsigned int code) const; |
32 bool HasRelEvent(unsigned int code) const; | 35 bool HasRelEvent(unsigned int code) const; |
33 bool HasAbsEvent(unsigned int code) const; | 36 bool HasAbsEvent(unsigned int code) const; |
34 bool HasMscEvent(unsigned int code) const; | 37 bool HasMscEvent(unsigned int code) const; |
35 bool HasSwEvent(unsigned int code) const; | 38 bool HasSwEvent(unsigned int code) const; |
36 bool HasLedEvent(unsigned int code) const; | 39 bool HasLedEvent(unsigned int code) const; |
37 | 40 |
38 // Properties of absolute axes. | 41 // Properties of absolute axes. |
39 int32 GetAbsMinimum(unsigned int code) const; | 42 int32 GetAbsMinimum(unsigned int code) const; |
40 int32 GetAbsMaximum(unsigned int code) const; | 43 int32 GetAbsMaximum(unsigned int code) const; |
44 int32 GetSlotValue(unsigned int code, unsigned int slot) const; | |
41 | 45 |
42 // Check input device properties. | 46 // Check input device properties. |
43 bool HasProp(unsigned int code) const; | 47 bool HasProp(unsigned int code) const; |
44 | 48 |
45 // Has absolute X & Y axes. | 49 // Has absolute X & Y axes. |
46 bool HasAbsXY() const; | 50 bool HasAbsXY() const; |
47 | 51 |
48 // Has relativeX & Y axes. | 52 // Has relativeX & Y axes. |
49 bool HasRelXY() const; | 53 bool HasRelXY() const; |
50 | 54 |
51 // Determine whether absolute device X/Y coordinates are mapped onto the | 55 // Determine whether absolute device X/Y coordinates are mapped onto the |
52 // 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. |
53 bool IsMappedToScreen() const; | 57 bool IsMappedToScreen() const; |
54 | 58 |
55 private: | 59 private: |
56 unsigned long ev_bits_[EVDEV_BITS_TO_LONGS(EV_CNT)]; | 60 unsigned long ev_bits_[EVDEV_BITS_TO_LONGS(EV_CNT)]; |
57 unsigned long key_bits_[EVDEV_BITS_TO_LONGS(KEY_CNT)]; | 61 unsigned long key_bits_[EVDEV_BITS_TO_LONGS(KEY_CNT)]; |
58 unsigned long rel_bits_[EVDEV_BITS_TO_LONGS(REL_CNT)]; | 62 unsigned long rel_bits_[EVDEV_BITS_TO_LONGS(REL_CNT)]; |
59 unsigned long abs_bits_[EVDEV_BITS_TO_LONGS(ABS_CNT)]; | 63 unsigned long abs_bits_[EVDEV_BITS_TO_LONGS(ABS_CNT)]; |
60 unsigned long msc_bits_[EVDEV_BITS_TO_LONGS(MSC_CNT)]; | 64 unsigned long msc_bits_[EVDEV_BITS_TO_LONGS(MSC_CNT)]; |
61 unsigned long sw_bits_[EVDEV_BITS_TO_LONGS(SW_CNT)]; | 65 unsigned long sw_bits_[EVDEV_BITS_TO_LONGS(SW_CNT)]; |
62 unsigned long led_bits_[EVDEV_BITS_TO_LONGS(LED_CNT)]; | 66 unsigned long led_bits_[EVDEV_BITS_TO_LONGS(LED_CNT)]; |
63 unsigned long prop_bits_[EVDEV_BITS_TO_LONGS(INPUT_PROP_CNT)]; | 67 unsigned long prop_bits_[EVDEV_BITS_TO_LONGS(INPUT_PROP_CNT)]; |
64 | 68 |
65 struct input_absinfo abs_info_[ABS_CNT]; | 69 struct input_absinfo abs_info_[ABS_CNT]; |
66 | 70 |
71 // Store the values for the multi-touch properties for each slot. | |
72 int32_t* slot_values_[ABS_MT_COUNT]; | |
73 | |
67 DISALLOW_COPY_AND_ASSIGN(EventDeviceInfo); | 74 DISALLOW_COPY_AND_ASSIGN(EventDeviceInfo); |
68 }; | 75 }; |
69 | 76 |
70 } // namspace ui | 77 } // namspace ui |
71 | 78 |
72 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_DEVICE_INFO_H_ | 79 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_DEVICE_INFO_H_ |
OLD | NEW |