diff options
Diffstat (limited to 'services/input/InputReader.h')
-rw-r--r-- | services/input/InputReader.h | 73 |
1 files changed, 42 insertions, 31 deletions
diff --git a/services/input/InputReader.h b/services/input/InputReader.h index 655f0f0..68002ca 100644 --- a/services/input/InputReader.h +++ b/services/input/InputReader.h @@ -389,7 +389,7 @@ private: class KeyboardInputMapper : public InputMapper { public: - KeyboardInputMapper(InputDevice* device, uint32_t sources, int32_t keyboardType); + KeyboardInputMapper(InputDevice* device, uint32_t source, int32_t keyboardType); virtual ~KeyboardInputMapper(); virtual uint32_t getSources(); @@ -414,7 +414,7 @@ private: int32_t scanCode; }; - uint32_t mSources; + uint32_t mSource; int32_t mKeyboardType; // Immutable configuration parameters. @@ -493,7 +493,7 @@ private: struct Accumulator { enum { - FIELD_BTN_MOUSE = 1, + FIELD_BUTTONS = 1, FIELD_REL_X = 2, FIELD_REL_Y = 4, FIELD_REL_WHEEL = 8, @@ -502,7 +502,9 @@ private: uint32_t fields; - bool btnMouse; + uint32_t buttonDown; + uint32_t buttonUp; + int32_t relX; int32_t relY; int32_t relWheel; @@ -513,7 +515,7 @@ private: } } mAccumulator; - int32_t mSources; + int32_t mSource; float mXScale; float mYScale; float mXPrecision; @@ -527,7 +529,7 @@ private: sp<PointerControllerInterface> mPointerController; struct LockedState { - bool down; + uint32_t buttonState; nsecs_t downTime; } mLocked; @@ -629,7 +631,7 @@ protected: }; // Input sources supported by the device. - int32_t mSources; + uint32_t mTouchSource; // sources when reporting touch data // Immutable configuration parameters. struct Parameters { @@ -650,16 +652,6 @@ protected: // Immutable calibration parameters in parsed form. struct Calibration { - // Position - bool haveXOrigin; - int32_t xOrigin; - bool haveYOrigin; - int32_t yOrigin; - bool haveXScale; - float xScale; - bool haveYScale; - float yScale; - // Touch Size enum TouchSizeCalibration { TOUCH_SIZE_CALIBRATION_DEFAULT, @@ -755,12 +747,14 @@ protected: int32_t surfaceOrientation; int32_t surfaceWidth, surfaceHeight; + // The associated display orientation and width and height set by configureSurfaceLocked(). + int32_t associatedDisplayOrientation; + int32_t associatedDisplayWidth, associatedDisplayHeight; + // Translation and scaling factors, orientation-independent. - int32_t xOrigin; float xScale; float xPrecision; - int32_t yOrigin; float yScale; float yPrecision; @@ -882,7 +876,7 @@ private: void dispatchTouch(nsecs_t when, uint32_t policyFlags, TouchData* touch, BitSet32 idBits, uint32_t changedId, uint32_t pointerCount, int32_t motionEventAction); - void detectGestures(nsecs_t when); + void suppressSwipeOntoVirtualKeys(nsecs_t when); bool isPointInsideSurfaceLocked(int32_t x, int32_t y); const VirtualKey* findVirtualKeyHitLocked(int32_t x, int32_t y); @@ -912,7 +906,7 @@ private: FIELD_ABS_X = 2, FIELD_ABS_Y = 4, FIELD_ABS_PRESSURE = 8, - FIELD_ABS_TOOL_WIDTH = 16 + FIELD_ABS_TOOL_WIDTH = 16, }; uint32_t fields; @@ -1011,38 +1005,50 @@ public: private: struct Axis { RawAbsoluteAxisInfo rawAxisInfo; + AxisInfo axisInfo; - int32_t axis; // axis id bool explicitlyMapped; // true if the axis was explicitly assigned an axis id float scale; // scale factor from raw to normalized values float offset; // offset to add after scaling for normalization + float highScale; // scale factor from raw to normalized values of high split + float highOffset; // offset to add after scaling for normalization of high split float min; // normalized inclusive minimum float max; // normalized inclusive maximum float flat; // normalized flat region size float fuzz; // normalized error tolerance - float oldValue; // previous value - float newValue; // most recent value - float filter; // filter out small variations of this size + float currentValue; // current value + float newValue; // most recent value + float highCurrentValue; // current value of high split + float highNewValue; // most recent value of high split - void initialize(const RawAbsoluteAxisInfo& rawAxisInfo, - int32_t axis, bool explicitlyMapped, float scale, float offset, + void initialize(const RawAbsoluteAxisInfo& rawAxisInfo, const AxisInfo& axisInfo, + bool explicitlyMapped, float scale, float offset, + float highScale, float highOffset, float min, float max, float flat, float fuzz) { this->rawAxisInfo = rawAxisInfo; - this->axis = axis; + this->axisInfo = axisInfo; this->explicitlyMapped = explicitlyMapped; this->scale = scale; this->offset = offset; + this->highScale = highScale; + this->highOffset = highOffset; this->min = min; this->max = max; this->flat = flat; this->fuzz = fuzz; this->filter = 0; - this->oldValue = 0; + resetValue(); + } + + void resetValue() { + this->currentValue = 0; this->newValue = 0; + this->highCurrentValue = 0; + this->highNewValue = 0; } }; @@ -1051,9 +1057,14 @@ private: void sync(nsecs_t when, bool force); - bool haveAxis(int32_t axis); + bool haveAxis(int32_t axisId); void pruneAxes(bool ignoreExplicitlyMappedAxes); - bool haveAxesChangedSignificantly(); + bool filterAxes(bool force); + + static bool hasValueChangedSignificantly(float filter, + float newValue, float currentValue, float min, float max); + static bool hasMovedNearerToValueWithinFilteredRange(float filter, + float newValue, float currentValue, float thresholdValue); static bool isCenteredAxis(int32_t axis); }; |