Loading services/inputflinger/InputReader.cpp +13 −2 Original line number Original line Diff line number Diff line Loading @@ -2751,7 +2751,18 @@ void RotaryEncoderInputMapper::populateDeviceInfo(InputDeviceInfo* info) { InputMapper::populateDeviceInfo(info); InputMapper::populateDeviceInfo(info); if (mRotaryEncoderScrollAccumulator.haveRelativeVWheel()) { if (mRotaryEncoderScrollAccumulator.haveRelativeVWheel()) { info->addMotionRange(AMOTION_EVENT_AXIS_SCROLL, mSource, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f); float res = 0.0f; if (!mDevice->getConfiguration().tryGetProperty(String8("device.res"), res)) { ALOGW("Rotary Encoder device configuration file didn't specify resolution!\n"); } if (!mDevice->getConfiguration().tryGetProperty(String8("device.scalingFactor"), mScalingFactor)) { ALOGW("Rotary Encoder device configuration file didn't specify scaling factor," "default to 1.0!\n"); mScalingFactor = 1.0f; } info->addMotionRange(AMOTION_EVENT_AXIS_SCROLL, mSource, -1.0f, 1.0f, 0.0f, 0.0f, res * mScalingFactor); } } } } Loading Loading @@ -2807,7 +2818,7 @@ void RotaryEncoderInputMapper::sync(nsecs_t when) { // Send motion event. // Send motion event. if (scrolled) { if (scrolled) { int32_t metaState = mContext->getGlobalMetaState(); int32_t metaState = mContext->getGlobalMetaState(); pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_SCROLL, scroll); pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_SCROLL, scroll * mScalingFactor); NotifyMotionArgs scrollArgs(when, getDeviceId(), mSource, policyFlags, NotifyMotionArgs scrollArgs(when, getDeviceId(), mSource, policyFlags, AMOTION_EVENT_ACTION_SCROLL, 0, 0, metaState, 0, AMOTION_EVENT_ACTION_SCROLL, 0, 0, metaState, 0, Loading services/inputflinger/InputReader.h +1 −0 Original line number Original line Diff line number Diff line Loading @@ -1247,6 +1247,7 @@ private: CursorScrollAccumulator mRotaryEncoderScrollAccumulator; CursorScrollAccumulator mRotaryEncoderScrollAccumulator; int32_t mSource; int32_t mSource; float mScalingFactor; void sync(nsecs_t when); void sync(nsecs_t when); }; }; Loading Loading
services/inputflinger/InputReader.cpp +13 −2 Original line number Original line Diff line number Diff line Loading @@ -2751,7 +2751,18 @@ void RotaryEncoderInputMapper::populateDeviceInfo(InputDeviceInfo* info) { InputMapper::populateDeviceInfo(info); InputMapper::populateDeviceInfo(info); if (mRotaryEncoderScrollAccumulator.haveRelativeVWheel()) { if (mRotaryEncoderScrollAccumulator.haveRelativeVWheel()) { info->addMotionRange(AMOTION_EVENT_AXIS_SCROLL, mSource, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f); float res = 0.0f; if (!mDevice->getConfiguration().tryGetProperty(String8("device.res"), res)) { ALOGW("Rotary Encoder device configuration file didn't specify resolution!\n"); } if (!mDevice->getConfiguration().tryGetProperty(String8("device.scalingFactor"), mScalingFactor)) { ALOGW("Rotary Encoder device configuration file didn't specify scaling factor," "default to 1.0!\n"); mScalingFactor = 1.0f; } info->addMotionRange(AMOTION_EVENT_AXIS_SCROLL, mSource, -1.0f, 1.0f, 0.0f, 0.0f, res * mScalingFactor); } } } } Loading Loading @@ -2807,7 +2818,7 @@ void RotaryEncoderInputMapper::sync(nsecs_t when) { // Send motion event. // Send motion event. if (scrolled) { if (scrolled) { int32_t metaState = mContext->getGlobalMetaState(); int32_t metaState = mContext->getGlobalMetaState(); pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_SCROLL, scroll); pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_SCROLL, scroll * mScalingFactor); NotifyMotionArgs scrollArgs(when, getDeviceId(), mSource, policyFlags, NotifyMotionArgs scrollArgs(when, getDeviceId(), mSource, policyFlags, AMOTION_EVENT_ACTION_SCROLL, 0, 0, metaState, 0, AMOTION_EVENT_ACTION_SCROLL, 0, 0, metaState, 0, Loading
services/inputflinger/InputReader.h +1 −0 Original line number Original line Diff line number Diff line Loading @@ -1247,6 +1247,7 @@ private: CursorScrollAccumulator mRotaryEncoderScrollAccumulator; CursorScrollAccumulator mRotaryEncoderScrollAccumulator; int32_t mSource; int32_t mSource; float mScalingFactor; void sync(nsecs_t when); void sync(nsecs_t when); }; }; Loading