Add initial API for stylus and mouse buttons.
Added the concept of pointer properties in a MotionEvent. This is currently used to track the pointer tool type to enable applications to distinguish finger touches from a stylus. Button states are also reported to application as part of touch events. There are no new actions for detecting changes in button states. The application should instead query the button state from the MotionEvent and take appropriate action as needed. A good time to check the button state is on ACTION_DOWN. As a side-effect, applications that do not support multiple buttons will treat primary, secondary and tertiary buttons identically for all touch events. The back button on the mouse is mapped to KEYCODE_BACK and the forward button is mapped to KEYCODE_FORWARD. Added basic plumbing for the secondary mouse button to invoke the context menu, particularly in lists. Added clamp and split methods on MotionEvent to take care of common filtering operations so we don't have them scattered in multiple places across the framework. Bug: 4260011 Change-Id: Ie992b4d4e00c8f2e76b961da0a902145b27f6d83
This commit is contained in:
@ -137,7 +137,7 @@ void PointerController::move(float deltaX, float deltaY) {
|
||||
setPositionLocked(mLocked.pointerX + deltaX, mLocked.pointerY + deltaY);
|
||||
}
|
||||
|
||||
void PointerController::setButtonState(uint32_t buttonState) {
|
||||
void PointerController::setButtonState(int32_t buttonState) {
|
||||
#if DEBUG_POINTER_UPDATES
|
||||
LOGD("Set button state 0x%08x", buttonState);
|
||||
#endif
|
||||
@ -148,7 +148,7 @@ void PointerController::setButtonState(uint32_t buttonState) {
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t PointerController::getButtonState() const {
|
||||
int32_t PointerController::getButtonState() const {
|
||||
AutoMutex _l(mLock);
|
||||
|
||||
return mLocked.buttonState;
|
||||
|
Reference in New Issue
Block a user