diff options
author | Steve Kondik <shade@chemlab.org> | 2012-07-09 09:49:39 +0400 |
---|---|---|
committer | Gerrit Code Review <gerrit@review.cyanogenmod.com> | 2012-07-09 09:49:39 +0400 |
commit | 77c5f0597fa9692f7038a2d93cd93c91c2f1f81e (patch) | |
tree | 35578b2813817641f59358118f20ad5ce3fadb1f /services | |
parent | 3c606f5e7664f8eec36f24ac7b2b74ad099e0993 (diff) | |
parent | 96bbc92520d4214458d6dd3fdc37f5b82e0b3982 (diff) | |
download | frameworks_base-77c5f0597fa9692f7038a2d93cd93c91c2f1f81e.zip frameworks_base-77c5f0597fa9692f7038a2d93cd93c91c2f1f81e.tar.gz frameworks_base-77c5f0597fa9692f7038a2d93cd93c91c2f1f81e.tar.bz2 |
Merge "Disable touch while using the stylus (Galaxy Note)" into ics
Diffstat (limited to 'services')
-rw-r--r-- | services/input/InputReader.cpp | 16 | ||||
-rw-r--r-- | services/input/InputReader.h | 12 |
2 files changed, 27 insertions, 1 deletions
diff --git a/services/input/InputReader.cpp b/services/input/InputReader.cpp index c66e7a1..d9290f4 100644 --- a/services/input/InputReader.cpp +++ b/services/input/InputReader.cpp @@ -4991,6 +4991,7 @@ void TouchInputMapper::dispatchPointerStylus(nsecs_t when, uint32_t policyFlags) mPointerSimple.currentProperties.id = 0; mPointerSimple.currentProperties.toolType = mCurrentCookedPointerData.pointerProperties[index].toolType; + mLastStylusTime = when; } else { down = false; hovering = false; @@ -5073,6 +5074,11 @@ void TouchInputMapper::dispatchPointerSimple(nsecs_t when, uint32_t policyFlags, } } + if (rejectPalm(when)) { // stylus is currently active + mPointerSimple.reset(); + return; + } + if (mPointerSimple.down && !down) { mPointerSimple.down = false; @@ -5183,6 +5189,9 @@ void TouchInputMapper::dispatchMotion(nsecs_t when, uint32_t policyFlags, uint32 const PointerProperties* properties, const PointerCoords* coords, const uint32_t* idToIndex, BitSet32 idBits, int32_t changedId, float xPrecision, float yPrecision, nsecs_t downTime) { + + if (rejectPalm(when)) return; + PointerCoords pointerCoords[MAX_POINTERS]; PointerProperties pointerProperties[MAX_POINTERS]; uint32_t pointerCount = 0; @@ -5262,6 +5271,13 @@ void TouchInputMapper::unfadePointer(PointerControllerInterface::Transition tran } } +nsecs_t TouchInputMapper::mLastStylusTime = 0; + +bool TouchInputMapper::rejectPalm(nsecs_t when) { + return (when - mLastStylusTime < mConfig.stylusPalmRejectionTime) && + mPointerSimple.currentProperties.toolType != AMOTION_EVENT_TOOL_TYPE_STYLUS; +} + bool TouchInputMapper::isPointInsideSurface(int32_t x, int32_t y) { return x >= mRawPointerAxes.x.minValue && x <= mRawPointerAxes.x.maxValue && y >= mRawPointerAxes.y.minValue && y <= mRawPointerAxes.y.maxValue; diff --git a/services/input/InputReader.h b/services/input/InputReader.h index 379229f..6167508 100644 --- a/services/input/InputReader.h +++ b/services/input/InputReader.h @@ -152,6 +152,9 @@ struct InputReaderConfiguration { // True to show the pointer icon when a stylus is used. bool stylusIconEnabled; + // Ignore finger touches this long after the stylus has been used (including hover) + nsecs_t stylusPalmRejectionTime; + InputReaderConfiguration() : virtualKeyQuietTime(0), pointerVelocityControlParameters(1.0f, 500.0f, 3000.0f, 3.0f), @@ -169,7 +172,9 @@ struct InputReaderConfiguration { pointerGestureMovementSpeedRatio(0.8f), pointerGestureZoomSpeedRatio(0.3f), showTouches(false), - stylusIconEnabled(false) { } + stylusIconEnabled(false), + stylusPalmRejectionTime(50 * 10000000LL) // 50 ms + { } bool getDisplayInfo(int32_t displayId, bool external, int32_t* width, int32_t* height, int32_t* orientation) const; @@ -1480,6 +1485,9 @@ private: VelocityControl mWheelXVelocityControl; VelocityControl mWheelYVelocityControl; + // The time the stylus event was processed by any TouchInputMapper + static nsecs_t mLastStylusTime; + void sync(nsecs_t when); bool consumeRawTouches(nsecs_t when, uint32_t policyFlags); @@ -1534,6 +1542,8 @@ private: void assignPointerIds(); void unfadePointer(PointerControllerInterface::Transition transition); + + bool rejectPalm(nsecs_t when); }; |