diff options
| author | 2011-06-28 20:17:59 -0700 | |
|---|---|---|
| committer | 2011-06-28 20:17:59 -0700 | |
| commit | e9e860762b58a2d3475b2b677db53864000c524c (patch) | |
| tree | 45070a445ccbe84dddc31ea3e10d130dd9da5a79 /services/input/InputReader.cpp | |
| parent | cf93ed0d0ab3e158f89ff53ac302942f9deff479 (diff) | |
| parent | 8134681b25dfff814ffeaad8ff70e84316c1869f (diff) | |
Merge "Improve input event consistency invariants."
Diffstat (limited to 'services/input/InputReader.cpp')
| -rw-r--r-- | services/input/InputReader.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/services/input/InputReader.cpp b/services/input/InputReader.cpp index 5a25f8cc9584..a16e7d7caa1e 100644 --- a/services/input/InputReader.cpp +++ b/services/input/InputReader.cpp @@ -3704,6 +3704,29 @@ void TouchInputMapper::dispatchPointerGestures(nsecs_t when, uint32_t policyFlag mPointerGesture.currentGestureCoords, mPointerGesture.currentGestureIdToIndex, mPointerGesture.currentGestureIdBits, -1, 0, 0, mPointerGesture.downTime); + } else if (dispatchedGestureIdBits.isEmpty() + && !mPointerGesture.lastGestureIdBits.isEmpty()) { + // Synthesize a hover move event after all pointers go up to indicate that + // the pointer is hovering again even if the user is not currently touching + // the touch pad. This ensures that a view will receive a fresh hover enter + // event after a tap. + float x, y; + mPointerController->getPosition(&x, &y); + + PointerProperties pointerProperties; + pointerProperties.clear(); + pointerProperties.id = 0; + pointerProperties.toolType = AMOTION_EVENT_TOOL_TYPE_INDIRECT_FINGER; + + PointerCoords pointerCoords; + pointerCoords.clear(); + pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_X, x); + pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_Y, y); + + getDispatcher()->notifyMotion(when, getDeviceId(), mPointerSource, policyFlags, + AMOTION_EVENT_ACTION_HOVER_MOVE, 0, + metaState, buttonState, AMOTION_EVENT_EDGE_FLAG_NONE, + 1, &pointerProperties, &pointerCoords, 0, 0, mPointerGesture.downTime); } // Update state. |