diff options
| author | Jeff Brown <jeffbrown@google.com> | 2010-07-15 23:47:29 -0700 |
|---|---|---|
| committer | Jeff Brown <jeffbrown@google.com> | 2010-07-15 23:47:29 -0700 |
| commit | b75fa30aaf03d9e425d150b452501e5df0621351 (patch) | |
| tree | c7914253bdc9964a7bca8093341173a91341c74d /include | |
| parent | 3fdab65f244c92aed36bc0a5ee435d5dfbe2d673 (diff) | |
| parent | aca672ba2eea19420df16906851d56077a3fd3b2 (diff) | |
| download | frameworks_base-b75fa30aaf03d9e425d150b452501e5df0621351.zip frameworks_base-b75fa30aaf03d9e425d150b452501e5df0621351.tar.gz frameworks_base-b75fa30aaf03d9e425d150b452501e5df0621351.tar.bz2 | |
resolved conflicts for merge of aca672ba to master
Change-Id: I7ae11fca0acdbf513a4870226d0d3e3cafbe9a08
Diffstat (limited to 'include')
| -rw-r--r-- | include/ui/EventHub.h | 26 | ||||
| -rw-r--r-- | include/ui/Input.h | 61 | ||||
| -rw-r--r-- | include/ui/InputDevice.h | 19 | ||||
| -rw-r--r-- | include/ui/InputDispatcher.h | 16 | ||||
| -rw-r--r-- | include/ui/InputTransport.h | 10 |
5 files changed, 109 insertions, 23 deletions
diff --git a/include/ui/EventHub.h b/include/ui/EventHub.h index d322a34..5be17d3 100644 --- a/include/ui/EventHub.h +++ b/include/ui/EventHub.h @@ -60,6 +60,32 @@ namespace android { class KeyLayoutMap; /* + * Input device classes. + */ +enum { + /* The input device is a keyboard. */ + INPUT_DEVICE_CLASS_KEYBOARD = 0x00000001, + + /* The input device is an alpha-numeric keyboard (not just a dial pad). */ + INPUT_DEVICE_CLASS_ALPHAKEY = 0x00000002, + + /* The input device is a touchscreen (either single-touch or multi-touch). */ + INPUT_DEVICE_CLASS_TOUCHSCREEN = 0x00000004, + + /* The input device is a trackball. */ + INPUT_DEVICE_CLASS_TRACKBALL = 0x00000008, + + /* The input device is a multi-touch touchscreen. */ + INPUT_DEVICE_CLASS_TOUCHSCREEN_MT= 0x00000010, + + /* The input device is a directional pad. */ + INPUT_DEVICE_CLASS_DPAD = 0x00000020, + + /* The input device is a gamepad (implies keyboard). */ + INPUT_DEVICE_CLASS_GAMEPAD = 0x00000040 +}; + +/* * Grand Central Station for events. * * The event hub aggregates input events received across all known input diff --git a/include/ui/Input.h b/include/ui/Input.h index a7d23d4..f069888 100644 --- a/include/ui/Input.h +++ b/include/ui/Input.h @@ -32,7 +32,7 @@ enum { /* * Private control to determine when an app is tracking a key sequence. */ - KEY_EVENT_FLAG_START_TRACKING = 0x40000000 + AKEY_EVENT_FLAG_START_TRACKING = 0x40000000 }; /* @@ -130,6 +130,11 @@ struct PointerCoords { float y; float pressure; float size; + float touchMajor; + float touchMinor; + float toolMajor; + float toolMinor; + float orientation; }; /* @@ -143,14 +148,14 @@ public: inline int32_t getDeviceId() const { return mDeviceId; } - inline int32_t getNature() const { return mNature; } + inline int32_t getSource() const { return mSource; } protected: - void initialize(int32_t deviceId, int32_t nature); + void initialize(int32_t deviceId, int32_t source); private: int32_t mDeviceId; - int32_t mNature; + int32_t mSource; }; /* @@ -160,7 +165,7 @@ class KeyEvent : public InputEvent { public: virtual ~KeyEvent() { } - virtual int32_t getType() const { return INPUT_EVENT_TYPE_KEY; } + virtual int32_t getType() const { return AINPUT_EVENT_TYPE_KEY; } inline int32_t getAction() const { return mAction; } @@ -188,7 +193,7 @@ public: void initialize( int32_t deviceId, - int32_t nature, + int32_t source, int32_t action, int32_t flags, int32_t keyCode, @@ -216,7 +221,7 @@ class MotionEvent : public InputEvent { public: virtual ~MotionEvent() { } - virtual int32_t getType() const { return INPUT_EVENT_TYPE_MOTION; } + virtual int32_t getType() const { return AINPUT_EVENT_TYPE_MOTION; } inline int32_t getAction() const { return mAction; } @@ -264,6 +269,26 @@ public: return getCurrentPointerCoords(pointerIndex).size; } + inline float getTouchMajor(size_t pointerIndex) const { + return getCurrentPointerCoords(pointerIndex).touchMajor; + } + + inline float getTouchMinor(size_t pointerIndex) const { + return getCurrentPointerCoords(pointerIndex).touchMinor; + } + + inline float getToolMajor(size_t pointerIndex) const { + return getCurrentPointerCoords(pointerIndex).toolMajor; + } + + inline float getToolMinor(size_t pointerIndex) const { + return getCurrentPointerCoords(pointerIndex).toolMinor; + } + + inline float getOrientation(size_t pointerIndex) const { + return getCurrentPointerCoords(pointerIndex).orientation; + } + inline size_t getHistorySize() const { return mSampleEventTimes.size() - 1; } inline nsecs_t getHistoricalEventTime(size_t historicalIndex) const { @@ -294,9 +319,29 @@ public: return getHistoricalPointerCoords(pointerIndex, historicalIndex).size; } + inline float getHistoricalTouchMajor(size_t pointerIndex, size_t historicalIndex) const { + return getHistoricalPointerCoords(pointerIndex, historicalIndex).touchMajor; + } + + inline float getHistoricalTouchMinor(size_t pointerIndex, size_t historicalIndex) const { + return getHistoricalPointerCoords(pointerIndex, historicalIndex).touchMinor; + } + + inline float getHistoricalToolMajor(size_t pointerIndex, size_t historicalIndex) const { + return getHistoricalPointerCoords(pointerIndex, historicalIndex).toolMajor; + } + + inline float getHistoricalToolMinor(size_t pointerIndex, size_t historicalIndex) const { + return getHistoricalPointerCoords(pointerIndex, historicalIndex).toolMinor; + } + + inline float getHistoricalOrientation(size_t pointerIndex, size_t historicalIndex) const { + return getHistoricalPointerCoords(pointerIndex, historicalIndex).orientation; + } + void initialize( int32_t deviceId, - int32_t nature, + int32_t source, int32_t action, int32_t edgeFlags, int32_t metaState, diff --git a/include/ui/InputDevice.h b/include/ui/InputDevice.h index 4420600..3b9c70e 100644 --- a/include/ui/InputDevice.h +++ b/include/ui/InputDevice.h @@ -42,6 +42,7 @@ namespace android { extern int32_t updateMetaState(int32_t keyCode, bool down, int32_t oldMetaState); extern int32_t rotateKeyCode(int32_t keyCode, int32_t orientation); + /* * An input device structure tracks the state of a single input device. * @@ -168,8 +169,11 @@ struct InputDevice { FIELD_ABS_MT_POSITION_X = 1, FIELD_ABS_MT_POSITION_Y = 2, FIELD_ABS_MT_TOUCH_MAJOR = 4, - FIELD_ABS_MT_WIDTH_MAJOR = 8, - FIELD_ABS_MT_TRACKING_ID = 16 + FIELD_ABS_MT_TOUCH_MINOR = 8, + FIELD_ABS_MT_WIDTH_MAJOR = 16, + FIELD_ABS_MT_WIDTH_MINOR = 32, + FIELD_ABS_MT_ORIENTATION = 64, + FIELD_ABS_MT_TRACKING_ID = 128 }; uint32_t pointerCount; @@ -179,7 +183,10 @@ struct InputDevice { int32_t absMTPositionX; int32_t absMTPositionY; int32_t absMTTouchMajor; + int32_t absMTTouchMinor; int32_t absMTWidthMajor; + int32_t absMTWidthMinor; + int32_t absMTOrientation; int32_t absMTTrackingId; inline void clear() { @@ -206,6 +213,11 @@ struct InputDevice { int32_t y; int32_t pressure; int32_t size; + int32_t touchMajor; + int32_t touchMinor; + int32_t toolMajor; + int32_t toolMinor; + int32_t orientation; }; struct TouchData { @@ -236,6 +248,7 @@ struct InputDevice { AbsoluteAxisInfo yAxis; AbsoluteAxisInfo pressureAxis; AbsoluteAxisInfo sizeAxis; + AbsoluteAxisInfo orientationAxis; } parameters; // The touch data of the current sample being processed. @@ -290,6 +303,8 @@ struct InputDevice { int32_t sizeOrigin; float sizeScale; + + float orientationScale; } precalculated; void reset(); diff --git a/include/ui/InputDispatcher.h b/include/ui/InputDispatcher.h index eb8f820..674852a 100644 --- a/include/ui/InputDispatcher.h +++ b/include/ui/InputDispatcher.h @@ -167,10 +167,10 @@ public: */ virtual void notifyConfigurationChanged(nsecs_t eventTime) = 0; virtual void notifyAppSwitchComing(nsecs_t eventTime) = 0; - virtual void notifyKey(nsecs_t eventTime, int32_t deviceId, int32_t nature, + virtual void notifyKey(nsecs_t eventTime, int32_t deviceId, int32_t source, uint32_t policyFlags, int32_t action, int32_t flags, int32_t keyCode, int32_t scanCode, int32_t metaState, nsecs_t downTime) = 0; - virtual void notifyMotion(nsecs_t eventTime, int32_t deviceId, int32_t nature, + virtual void notifyMotion(nsecs_t eventTime, int32_t deviceId, int32_t source, uint32_t policyFlags, int32_t action, int32_t metaState, int32_t edgeFlags, uint32_t pointerCount, const int32_t* pointerIds, const PointerCoords* pointerCoords, float xPrecision, float yPrecision, nsecs_t downTime) = 0; @@ -232,10 +232,10 @@ public: virtual void notifyConfigurationChanged(nsecs_t eventTime); virtual void notifyAppSwitchComing(nsecs_t eventTime); - virtual void notifyKey(nsecs_t eventTime, int32_t deviceId, int32_t nature, + virtual void notifyKey(nsecs_t eventTime, int32_t deviceId, int32_t source, uint32_t policyFlags, int32_t action, int32_t flags, int32_t keyCode, int32_t scanCode, int32_t metaState, nsecs_t downTime); - virtual void notifyMotion(nsecs_t eventTime, int32_t deviceId, int32_t nature, + virtual void notifyMotion(nsecs_t eventTime, int32_t deviceId, int32_t source, uint32_t policyFlags, int32_t action, int32_t metaState, int32_t edgeFlags, uint32_t pointerCount, const int32_t* pointerIds, const PointerCoords* pointerCoords, float xPrecision, float yPrecision, nsecs_t downTime); @@ -281,7 +281,7 @@ private: struct KeyEntry : EventEntry { int32_t deviceId; - int32_t nature; + int32_t source; uint32_t policyFlags; int32_t action; int32_t flags; @@ -301,7 +301,7 @@ private: struct MotionEntry : EventEntry { int32_t deviceId; - int32_t nature; + int32_t source; uint32_t policyFlags; int32_t action; int32_t metaState; @@ -424,11 +424,11 @@ private: ConfigurationChangedEntry* obtainConfigurationChangedEntry(nsecs_t eventTime); KeyEntry* obtainKeyEntry(nsecs_t eventTime, - int32_t deviceId, int32_t nature, uint32_t policyFlags, int32_t action, + int32_t deviceId, int32_t source, uint32_t policyFlags, int32_t action, int32_t flags, int32_t keyCode, int32_t scanCode, int32_t metaState, int32_t repeatCount, nsecs_t downTime); MotionEntry* obtainMotionEntry(nsecs_t eventTime, - int32_t deviceId, int32_t nature, uint32_t policyFlags, int32_t action, + int32_t deviceId, int32_t source, uint32_t policyFlags, int32_t action, int32_t metaState, int32_t edgeFlags, float xPrecision, float yPrecision, nsecs_t downTime, uint32_t pointerCount, const int32_t* pointerIds, const PointerCoords* pointerCoords); diff --git a/include/ui/InputTransport.h b/include/ui/InputTransport.h index 226d1d5..31ec701 100644 --- a/include/ui/InputTransport.h +++ b/include/ui/InputTransport.h @@ -119,7 +119,7 @@ struct InputMessage { }; int32_t deviceId; - int32_t nature; + int32_t source; union { struct { @@ -198,7 +198,7 @@ public: */ status_t publishKeyEvent( int32_t deviceId, - int32_t nature, + int32_t source, int32_t action, int32_t flags, int32_t keyCode, @@ -216,7 +216,7 @@ public: */ status_t publishMotionEvent( int32_t deviceId, - int32_t nature, + int32_t source, int32_t action, int32_t edgeFlags, int32_t metaState, @@ -233,7 +233,7 @@ public: /* Appends a motion sample to a motion event unless already consumed. * * Returns OK on success. - * Returns INVALID_OPERATION if the current event is not a MOTION_EVENT_ACTION_MOVE event. + * Returns INVALID_OPERATION if the current event is not a AMOTION_EVENT_ACTION_MOVE event. * Returns FAILED_TRANSACTION if the current event has already been consumed. * Returns NO_MEMORY if the buffer is full and no additional samples can be added. */ @@ -272,7 +272,7 @@ private: status_t publishInputEvent( int32_t type, int32_t deviceId, - int32_t nature); + int32_t source); }; /* |
