Input improvements and bug fixes.
Associate each motion axis with the source from which it comes. It is possible for multiple sources of the same device to define the same axis. This fixes new API that was introduced in MR1. (Bug: 4066146) Fixed a bug that might cause a segfault when using a trackball. Only fade out the mouse pointer when touching the touch screen, ignore other touch pads. Changed the plural "sources" to "source" in several places in the InputReader where we intend to refer to a particular source rather than to a combination of sources. Improved the batching code to support batching events from different sources of the same device in parallel. (Bug: 3391564) Change-Id: I0189e18e464338f126f7bf94370b928e1b1695f2
This commit is contained in:
parent
95913fe87e
commit
46689da7ee
@ -143,6 +143,14 @@ enum {
|
||||
POLICY_FLAG_PASS_TO_USER = 0x40000000,
|
||||
};
|
||||
|
||||
/*
|
||||
* Button state.
|
||||
*/
|
||||
enum {
|
||||
// Primary button pressed (left mouse button).
|
||||
BUTTON_STATE_PRIMARY = 1 << 0,
|
||||
};
|
||||
|
||||
/*
|
||||
* Describes the basic configuration of input devices that are present.
|
||||
*/
|
||||
@ -544,6 +552,8 @@ public:
|
||||
~InputDeviceInfo();
|
||||
|
||||
struct MotionRange {
|
||||
int32_t axis;
|
||||
uint32_t source;
|
||||
float min;
|
||||
float max;
|
||||
float flat;
|
||||
@ -556,16 +566,17 @@ public:
|
||||
inline const String8 getName() const { return mName; }
|
||||
inline uint32_t getSources() const { return mSources; }
|
||||
|
||||
const MotionRange* getMotionRange(int32_t axis) const;
|
||||
const MotionRange* getMotionRange(int32_t axis, uint32_t source) const;
|
||||
|
||||
void addSource(uint32_t source);
|
||||
void addMotionRange(int32_t axis, float min, float max, float flat, float fuzz);
|
||||
void addMotionRange(int32_t axis, const MotionRange& range);
|
||||
void addMotionRange(int32_t axis, uint32_t source,
|
||||
float min, float max, float flat, float fuzz);
|
||||
void addMotionRange(const MotionRange& range);
|
||||
|
||||
inline void setKeyboardType(int32_t keyboardType) { mKeyboardType = keyboardType; }
|
||||
inline int32_t getKeyboardType() const { return mKeyboardType; }
|
||||
|
||||
inline const KeyedVector<int32_t, MotionRange> getMotionRanges() const {
|
||||
inline const Vector<MotionRange>& getMotionRanges() const {
|
||||
return mMotionRanges;
|
||||
}
|
||||
|
||||
@ -575,7 +586,7 @@ private:
|
||||
uint32_t mSources;
|
||||
int32_t mKeyboardType;
|
||||
|
||||
KeyedVector<int32_t, MotionRange> mMotionRanges;
|
||||
Vector<MotionRange> mMotionRanges;
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user