summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2010-07-16 15:01:56 -0700
committerJeff Brown <jeffbrown@google.com>2010-07-16 15:11:24 -0700
commit00ba884436dc8b222ad850c73c936d87bf4e84de (patch)
treeca4d18c6f004cf59a54508fa4e99f01f81e8753e /libs
parente068b46408f3ff390b47dc78ccf10fab76883051 (diff)
downloadframeworks_base-00ba884436dc8b222ad850c73c936d87bf4e84de.zip
frameworks_base-00ba884436dc8b222ad850c73c936d87bf4e84de.tar.gz
frameworks_base-00ba884436dc8b222ad850c73c936d87bf4e84de.tar.bz2
Fix individual pointer id up/down reporting.
Fix a minor threading bug in InputManager dump. Change-Id: Ic2eecf7df5a8dc9f40561fcb03ebe58a2c073778
Diffstat (limited to 'libs')
-rw-r--r--libs/ui/InputReader.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/libs/ui/InputReader.cpp b/libs/ui/InputReader.cpp
index cd4654a..403afe7 100644
--- a/libs/ui/InputReader.cpp
+++ b/libs/ui/InputReader.cpp
@@ -766,7 +766,7 @@ void InputReader::dispatchTouches(nsecs_t when,
// The dispatcher takes care of batching moves so we don't have to deal with that here.
int32_t motionEventAction = AMOTION_EVENT_ACTION_MOVE;
dispatchTouch(when, device, policyFlags, & device->touchScreen.currentTouch,
- currentIdBits, motionEventAction);
+ currentIdBits, -1, motionEventAction);
} else {
// There may be pointers going up and pointers going down at the same time when pointer
// ids are reported by the device driver.
@@ -784,12 +784,11 @@ void InputReader::dispatchTouches(nsecs_t when,
if (activeIdBits.isEmpty()) {
motionEventAction = AMOTION_EVENT_ACTION_UP;
} else {
- motionEventAction = AMOTION_EVENT_ACTION_POINTER_UP
- | (upId << AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT);
+ motionEventAction = AMOTION_EVENT_ACTION_POINTER_UP;
}
dispatchTouch(when, device, policyFlags, & device->touchScreen.lastTouch,
- oldActiveIdBits, motionEventAction);
+ oldActiveIdBits, upId, motionEventAction);
}
while (! downIdBits.isEmpty()) {
@@ -803,18 +802,17 @@ void InputReader::dispatchTouches(nsecs_t when,
motionEventAction = AMOTION_EVENT_ACTION_DOWN;
device->touchScreen.downTime = when;
} else {
- motionEventAction = AMOTION_EVENT_ACTION_POINTER_DOWN
- | (downId << AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT);
+ motionEventAction = AMOTION_EVENT_ACTION_POINTER_DOWN;
}
dispatchTouch(when, device, policyFlags, & device->touchScreen.currentTouch,
- activeIdBits, motionEventAction);
+ activeIdBits, downId, motionEventAction);
}
}
}
void InputReader::dispatchTouch(nsecs_t when, InputDevice* device, uint32_t policyFlags,
- InputDevice::TouchData* touch, BitSet32 idBits,
+ InputDevice::TouchData* touch, BitSet32 idBits, uint32_t changedId,
int32_t motionEventAction) {
int32_t orientedWidth, orientedHeight;
switch (mDisplayOrientation) {
@@ -904,12 +902,15 @@ void InputReader::dispatchTouch(nsecs_t when, InputDevice* device, uint32_t poli
pointerCoords[pointerCount].toolMinor = toolMinor;
pointerCoords[pointerCount].orientation = orientation;
+ if (id == changedId) {
+ motionEventAction |= pointerCount << AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;
+ }
+
pointerCount += 1;
}
// Check edge flags by looking only at the first pointer since the flags are
// global to the event.
- // XXX Maybe we should revise the edge flags API to work on a per-pointer basis.
int32_t motionEventEdgeFlags = 0;
if (motionEventAction == AMOTION_EVENT_ACTION_DOWN) {
if (pointerCoords[0].x <= 0) {