diff options
author | Jeff Brown <jeffbrown@google.com> | 2010-07-16 17:21:06 -0700 |
---|---|---|
committer | Jeff Brown <jeffbrown@google.com> | 2010-07-16 17:46:03 -0700 |
commit | d3616592fe1b315b589766c4b74ce728fc4968f5 (patch) | |
tree | ef2bc2b0bed3aa307d444d8cab413bec5722ea7c | |
parent | ace999b096739d376d4845c0ba94599197ff8477 (diff) | |
download | frameworks_base-d3616592fe1b315b589766c4b74ce728fc4968f5.zip frameworks_base-d3616592fe1b315b589766c4b74ce728fc4968f5.tar.gz frameworks_base-d3616592fe1b315b589766c4b74ce728fc4968f5.tar.bz2 |
Fix trackball down and movement bugs.
Bug: 2823788
Change-Id: Icb0c392b58f7e735614460b5eb87439cb73ac4f2
-rw-r--r-- | libs/ui/InputDispatcher.cpp | 12 | ||||
-rw-r--r-- | libs/ui/InputReader.cpp | 4 |
2 files changed, 15 insertions, 1 deletions
diff --git a/libs/ui/InputDispatcher.cpp b/libs/ui/InputDispatcher.cpp index a438c69..a55864b 100644 --- a/libs/ui/InputDispatcher.cpp +++ b/libs/ui/InputDispatcher.cpp @@ -650,10 +650,20 @@ void InputDispatcher::startDispatchCycleLocked(nsecs_t currentTime, firstMotionSample = & motionEntry->firstSample; } + // Set the X and Y offset depending on the input source. + float xOffset, yOffset; + if (motionEntry->source & AINPUT_SOURCE_CLASS_POINTER) { + xOffset = dispatchEntry->xOffset; + yOffset = dispatchEntry->yOffset; + } else { + xOffset = 0.0f; + yOffset = 0.0f; + } + // Publish the motion event and the first motion sample. status = connection->inputPublisher.publishMotionEvent(motionEntry->deviceId, motionEntry->source, action, motionEntry->edgeFlags, motionEntry->metaState, - dispatchEntry->xOffset, dispatchEntry->yOffset, + xOffset, yOffset, motionEntry->xPrecision, motionEntry->yPrecision, motionEntry->downTime, firstMotionSample->eventTime, motionEntry->pointerCount, motionEntry->pointerIds, diff --git a/libs/ui/InputReader.cpp b/libs/ui/InputReader.cpp index 403afe7..30e391f 100644 --- a/libs/ui/InputReader.cpp +++ b/libs/ui/InputReader.cpp @@ -270,6 +270,10 @@ void InputReader::handleKey(const RawEvent* rawEvent) { device->trackball.accumulator.fields |= InputDevice::TrackballState::Accumulator::FIELD_BTN_MOUSE; device->trackball.accumulator.btnMouse = down; + + // Process the trackball change now since we may not receive a sync immediately. + onTrackballStateChanged(rawEvent->when, device); + device->trackball.accumulator.clear(); return; } } |