diff options
| author | 2010-06-17 13:31:07 -0700 | |
|---|---|---|
| committer | 2010-06-17 13:31:07 -0700 | |
| commit | 42bb545a54d89f0ddbb230d7a01ea4210c0f6c00 (patch) | |
| tree | 081cfa7e6ae56ae6cdc67f4c95cfb6f0171bb434 /include/ui/Input.h | |
| parent | 747f75dc0882138828ac2b2752c2872ccae49747 (diff) | |
| parent | 5c225b1680e696ae8bbf505a1997d6f720672f74 (diff) | |
am 5c225b16: Even more native input dispatch work in progress.
Merge commit '5c225b1680e696ae8bbf505a1997d6f720672f74' into gingerbread-plus-aosp
* commit '5c225b1680e696ae8bbf505a1997d6f720672f74':
Even more native input dispatch work in progress.
Diffstat (limited to 'include/ui/Input.h')
| -rw-r--r-- | include/ui/Input.h | 49 |
1 files changed, 39 insertions, 10 deletions
diff --git a/include/ui/Input.h b/include/ui/Input.h index d45bfcfda946..92ff87209e17 100644 --- a/include/ui/Input.h +++ b/include/ui/Input.h @@ -148,6 +148,9 @@ private: int32_t mNature; }; +/* + * Key events. + */ class KeyEvent : public InputEvent { public: virtual ~KeyEvent() { } @@ -193,6 +196,9 @@ private: nsecs_t mEventTime; }; +/* + * Motion events. + */ class MotionEvent : public InputEvent { public: virtual ~MotionEvent() { } @@ -205,6 +211,10 @@ public: inline int32_t getMetaState() const { return mMetaState; } + inline float getXOffset() const { return mXOffset; } + + inline float getYOffset() const { return mYOffset; } + inline float getXPrecision() const { return mXPrecision; } inline float getYPrecision() const { return mYPrecision; } @@ -217,16 +227,20 @@ public: inline nsecs_t getEventTime() const { return mSampleEventTimes[getHistorySize()]; } - inline float getRawX() const { return mRawX; } + inline float getRawX(size_t pointerIndex) const { + return getCurrentPointerCoords(pointerIndex).x; + } - inline float getRawY() const { return mRawY; } + inline float getRawY(size_t pointerIndex) const { + return getCurrentPointerCoords(pointerIndex).y; + } inline float getX(size_t pointerIndex) const { - return getCurrentPointerCoords(pointerIndex).x; + return getRawX(pointerIndex) + mXOffset; } inline float getY(size_t pointerIndex) const { - return getCurrentPointerCoords(pointerIndex).y; + return getRawY(pointerIndex) + mYOffset; } inline float getPressure(size_t pointerIndex) const { @@ -243,14 +257,22 @@ public: return mSampleEventTimes[historicalIndex]; } - inline float getHistoricalX(size_t pointerIndex, size_t historicalIndex) const { + inline float getHistoricalRawX(size_t pointerIndex, size_t historicalIndex) const { return getHistoricalPointerCoords(pointerIndex, historicalIndex).x; } - inline float getHistoricalY(size_t pointerIndex, size_t historicalIndex) const { + inline float getHistoricalRawY(size_t pointerIndex, size_t historicalIndex) const { return getHistoricalPointerCoords(pointerIndex, historicalIndex).y; } + inline float getHistoricalX(size_t pointerIndex, size_t historicalIndex) const { + return getHistoricalRawX(pointerIndex, historicalIndex) + mXOffset; + } + + inline float getHistoricalY(size_t pointerIndex, size_t historicalIndex) const { + return getHistoricalRawY(pointerIndex, historicalIndex) + mYOffset; + } + inline float getHistoricalPressure(size_t pointerIndex, size_t historicalIndex) const { return getHistoricalPointerCoords(pointerIndex, historicalIndex).pressure; } @@ -265,8 +287,8 @@ public: int32_t action, int32_t edgeFlags, int32_t metaState, - float rawX, - float rawY, + float xOffset, + float yOffset, float xPrecision, float yPrecision, nsecs_t downTime, @@ -281,12 +303,19 @@ public: void offsetLocation(float xOffset, float yOffset); + // Low-level accessors. + inline const int32_t* getPointerIds() const { return mPointerIds.array(); } + inline const nsecs_t* getSampleEventTimes() const { return mSampleEventTimes.array(); } + inline const PointerCoords* getSamplePointerCoords() const { + return mSamplePointerCoords.array(); + } + private: int32_t mAction; int32_t mEdgeFlags; int32_t mMetaState; - float mRawX; - float mRawY; + float mXOffset; + float mYOffset; float mXPrecision; float mYPrecision; nsecs_t mDownTime; |