diff options
| author | 2011-03-09 18:39:46 -0800 | |
|---|---|---|
| committer | 2011-03-09 18:39:46 -0800 | |
| commit | 15a4fd40c776f02e3e4580224dacc8f62d6b366c (patch) | |
| tree | 0d8b458092bef088b6ce56a214f18d0eb8bb1d7e /libs/ui/Input.cpp | |
| parent | bc9caa3741cbf0a46a16b49bd0b54a7f1b82b9c9 (diff) | |
| parent | 4a5f03688155d6f2571094bba9f3d696d571251b (diff) | |
am e6f0ae12: am efd3266b: Input improvements and bug fixes.
* commit 'e6f0ae12b18819424dd8395b433a8fc9caefa77b':
Input improvements and bug fixes.
Diffstat (limited to 'libs/ui/Input.cpp')
| -rw-r--r-- | libs/ui/Input.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/libs/ui/Input.cpp b/libs/ui/Input.cpp index 0ed086662c..e2e698ef7b 100644 --- a/libs/ui/Input.cpp +++ b/libs/ui/Input.cpp @@ -657,23 +657,30 @@ void InputDeviceInfo::initialize(int32_t id, const String8& name) { mMotionRanges.clear(); } -const InputDeviceInfo::MotionRange* InputDeviceInfo::getMotionRange(int32_t axis) const { - ssize_t index = mMotionRanges.indexOfKey(axis); - return index >= 0 ? & mMotionRanges.valueAt(index) : NULL; +const InputDeviceInfo::MotionRange* InputDeviceInfo::getMotionRange( + int32_t axis, uint32_t source) const { + size_t numRanges = mMotionRanges.size(); + for (size_t i = 0; i < numRanges; i++) { + const MotionRange& range = mMotionRanges.itemAt(i); + if (range.axis == axis && range.source == source) { + return ⦥ + } + } + return NULL; } void InputDeviceInfo::addSource(uint32_t source) { mSources |= source; } -void InputDeviceInfo::addMotionRange(int32_t axis, float min, float max, +void InputDeviceInfo::addMotionRange(int32_t axis, uint32_t source, float min, float max, float flat, float fuzz) { - MotionRange range = { min, max, flat, fuzz }; - addMotionRange(axis, range); + MotionRange range = { axis, source, min, max, flat, fuzz }; + mMotionRanges.add(range); } -void InputDeviceInfo::addMotionRange(int32_t axis, const MotionRange& range) { - mMotionRanges.add(axis, range); +void InputDeviceInfo::addMotionRange(const MotionRange& range) { + mMotionRanges.add(range); } } // namespace android |