| 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 <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "ui/events/ozone/evdev/event_device_util.h" | 14 #include "ui/events/ozone/evdev/event_device_util.h" |
| 15 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" | 15 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" |
| 16 | 16 |
| 17 #if !defined(ABS_MT_TOOL_Y) |
| 18 #define ABS_MT_TOOL_Y 0x3d |
| 19 #endif |
| 20 |
| 17 // ABS_MT_SLOT isn't valid options for EVIOCGMTSLOTS ioctl. | 21 // ABS_MT_SLOT isn't valid options for EVIOCGMTSLOTS ioctl. |
| 18 #define EVDEV_ABS_MT_COUNT (ABS_MAX - ABS_MT_SLOT - 1) | 22 #define EVDEV_ABS_MT_FIRST ABS_MT_TOUCH_MAJOR |
| 23 #define EVDEV_ABS_MT_LAST ABS_MT_TOOL_Y |
| 24 #define EVDEV_ABS_MT_COUNT (EVDEV_ABS_MT_LAST - EVDEV_ABS_MT_FIRST + 1) |
| 19 | 25 |
| 20 namespace ui { | 26 namespace ui { |
| 21 | 27 |
| 22 // Input device types. | 28 // Input device types. |
| 23 enum EVENTS_OZONE_EVDEV_EXPORT EventDeviceType { | 29 enum EVENTS_OZONE_EVDEV_EXPORT EventDeviceType { |
| 24 DT_KEYBOARD, | 30 DT_KEYBOARD, |
| 25 DT_MOUSE, | 31 DT_MOUSE, |
| 26 DT_TOUCHPAD, | 32 DT_TOUCHPAD, |
| 27 DT_TOUCHSCREEN, | 33 DT_TOUCHSCREEN, |
| 28 DT_MULTITOUCH, | 34 DT_MULTITOUCH, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 45 // Manual initialization. | 51 // Manual initialization. |
| 46 void SetEventTypes(const unsigned long* ev_bits, size_t len); | 52 void SetEventTypes(const unsigned long* ev_bits, size_t len); |
| 47 void SetKeyEvents(const unsigned long* key_bits, size_t len); | 53 void SetKeyEvents(const unsigned long* key_bits, size_t len); |
| 48 void SetRelEvents(const unsigned long* rel_bits, size_t len); | 54 void SetRelEvents(const unsigned long* rel_bits, size_t len); |
| 49 void SetAbsEvents(const unsigned long* abs_bits, size_t len); | 55 void SetAbsEvents(const unsigned long* abs_bits, size_t len); |
| 50 void SetMscEvents(const unsigned long* msc_bits, size_t len); | 56 void SetMscEvents(const unsigned long* msc_bits, size_t len); |
| 51 void SetSwEvents(const unsigned long* sw_bits, size_t len); | 57 void SetSwEvents(const unsigned long* sw_bits, size_t len); |
| 52 void SetLedEvents(const unsigned long* led_bits, size_t len); | 58 void SetLedEvents(const unsigned long* led_bits, size_t len); |
| 53 void SetProps(const unsigned long* prop_bits, size_t len); | 59 void SetProps(const unsigned long* prop_bits, size_t len); |
| 54 void SetAbsInfo(unsigned int code, const input_absinfo& absinfo); | 60 void SetAbsInfo(unsigned int code, const input_absinfo& absinfo); |
| 61 void SetAbsMtSlots(int code, const std::vector<int32_t>& values); |
| 55 | 62 |
| 56 // Check events this device can generate. | 63 // Check events this device can generate. |
| 57 bool HasEventType(unsigned int type) const; | 64 bool HasEventType(unsigned int type) const; |
| 58 bool HasKeyEvent(unsigned int code) const; | 65 bool HasKeyEvent(unsigned int code) const; |
| 59 bool HasRelEvent(unsigned int code) const; | 66 bool HasRelEvent(unsigned int code) const; |
| 60 bool HasAbsEvent(unsigned int code) const; | 67 bool HasAbsEvent(unsigned int code) const; |
| 61 bool HasMscEvent(unsigned int code) const; | 68 bool HasMscEvent(unsigned int code) const; |
| 62 bool HasSwEvent(unsigned int code) const; | 69 bool HasSwEvent(unsigned int code) const; |
| 63 bool HasLedEvent(unsigned int code) const; | 70 bool HasLedEvent(unsigned int code) const; |
| 64 | 71 |
| 65 // Properties of absolute axes. | 72 // Properties of absolute axes. |
| 66 int32 GetAbsMinimum(unsigned int code) const; | 73 int32_t GetAbsMinimum(unsigned int code) const; |
| 67 int32 GetAbsMaximum(unsigned int code) const; | 74 int32_t GetAbsMaximum(unsigned int code) const; |
| 68 int32 GetSlotValue(unsigned int code, unsigned int slot) const; | 75 uint32_t GetAbsMtSlotCount() const; |
| 76 int32_t GetAbsMtSlotValue(unsigned int code, unsigned int slot) const; |
| 77 int32_t GetAbsMtSlotValueWithDefault(unsigned int code, |
| 78 unsigned int slot, |
| 79 int32_t default_value) const; |
| 69 | 80 |
| 70 // Check input device properties. | 81 // Check input device properties. |
| 71 bool HasProp(unsigned int code) const; | 82 bool HasProp(unsigned int code) const; |
| 72 | 83 |
| 73 // Has absolute X & Y axes (excludes MT) | 84 // Has absolute X & Y axes (excludes MT) |
| 74 bool HasAbsXY() const; | 85 bool HasAbsXY() const; |
| 75 | 86 |
| 76 // Has MT absolute events | 87 // Has MT absolute events |
| 77 bool HasMTAbsXY() const; | 88 bool HasMTAbsXY() const; |
| 78 | 89 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 102 // Determine whether there's a touchpad on this device. | 113 // Determine whether there's a touchpad on this device. |
| 103 bool HasTouchpad() const; | 114 bool HasTouchpad() const; |
| 104 | 115 |
| 105 // Determine whether there's a tablet on this device. | 116 // Determine whether there's a tablet on this device. |
| 106 bool HasTablet() const; | 117 bool HasTablet() const; |
| 107 | 118 |
| 108 // Determine whether there's a touchscreen on this device. | 119 // Determine whether there's a touchscreen on this device. |
| 109 bool HasTouchscreen() const; | 120 bool HasTouchscreen() const; |
| 110 | 121 |
| 111 private: | 122 private: |
| 112 // Return the slot vector in |slot_values_| for |code|. | |
| 113 const std::vector<int32_t>& GetMtSlotsForCode(int code) const; | |
| 114 | |
| 115 enum class LegacyAbsoluteDeviceType { | 123 enum class LegacyAbsoluteDeviceType { |
| 116 LADT_TOUCHPAD, | 124 LADT_TOUCHPAD, |
| 117 LADT_TOUCHSCREEN, | 125 LADT_TOUCHSCREEN, |
| 118 LADT_TABLET, | 126 LADT_TABLET, |
| 119 LADT_NONE, | 127 LADT_NONE, |
| 120 }; | 128 }; |
| 121 | 129 |
| 122 // Probe absolute X & Y axis behavior. This is for legacy drivers that | 130 // Probe absolute X & Y axis behavior. This is for legacy drivers that |
| 123 // do not tell us what the axes mean. | 131 // do not tell us what the axes mean. |
| 124 LegacyAbsoluteDeviceType ProbeLegacyAbsoluteDevice() const; | 132 LegacyAbsoluteDeviceType ProbeLegacyAbsoluteDevice() const; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 136 | 144 |
| 137 // Store the values for the multi-touch properties for each slot. | 145 // Store the values for the multi-touch properties for each slot. |
| 138 std::vector<int32_t> slot_values_[EVDEV_ABS_MT_COUNT]; | 146 std::vector<int32_t> slot_values_[EVDEV_ABS_MT_COUNT]; |
| 139 | 147 |
| 140 DISALLOW_COPY_AND_ASSIGN(EventDeviceInfo); | 148 DISALLOW_COPY_AND_ASSIGN(EventDeviceInfo); |
| 141 }; | 149 }; |
| 142 | 150 |
| 143 } // namspace ui | 151 } // namspace ui |
| 144 | 152 |
| 145 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_DEVICE_INFO_H_ | 153 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_DEVICE_INFO_H_ |
| OLD | NEW |