diff options
| author | 2020-07-07 23:15:56 +0000 | |
|---|---|---|
| committer | 2020-07-07 23:15:56 +0000 | |
| commit | dd8d140472042ecbcc6f15c19a147f790ca0b85a (patch) | |
| tree | 07e4307b24d1fe320e0a1e832855e2e5e5ab91dd | |
| parent | f82c14181d37a58532518f21b53b320d6f5f2866 (diff) | |
| parent | 976db0c3a27fcfd8122087a0b1a3936609b98487 (diff) | |
Move PointerController enums to enum classes. am: 976db0c3a2
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/12100258
Change-Id: Ibabf28a094c7b6a4915747cbd7f662396d05deef
4 files changed, 24 insertions, 23 deletions
diff --git a/services/inputflinger/include/PointerControllerInterface.h b/services/inputflinger/include/PointerControllerInterface.h index bffff881b2..85d7247915 100644 --- a/services/inputflinger/include/PointerControllerInterface.h +++ b/services/inputflinger/include/PointerControllerInterface.h @@ -59,11 +59,11 @@ public: /* Gets the absolute location of the pointer. */ virtual void getPosition(float* outX, float* outY) const = 0; - enum Transition { + enum class Transition { // Fade/unfade immediately. - TRANSITION_IMMEDIATE, + IMMEDIATE, // Fade/unfade gradually. - TRANSITION_GRADUAL, + GRADUAL, }; /* Fades the pointer out now. */ @@ -75,11 +75,11 @@ public: * wants to ensure that the pointer becomes visible again. */ virtual void unfade(Transition transition) = 0; - enum Presentation { + enum class Presentation { // Show the mouse pointer. - PRESENTATION_POINTER, + POINTER, // Show spots and a spot anchor in place of the mouse pointer. - PRESENTATION_SPOT, + SPOT, }; /* Sets the mode of the pointer controller. */ diff --git a/services/inputflinger/reader/InputReader.cpp b/services/inputflinger/reader/InputReader.cpp index d3441acd2b..06e374353c 100644 --- a/services/inputflinger/reader/InputReader.cpp +++ b/services/inputflinger/reader/InputReader.cpp @@ -427,7 +427,7 @@ void InputReader::updatePointerDisplayLocked() { void InputReader::fadePointerLocked() { std::shared_ptr<PointerControllerInterface> controller = mPointerController.lock(); if (controller != nullptr) { - controller->fade(PointerControllerInterface::TRANSITION_GRADUAL); + controller->fade(PointerControllerInterface::Transition::GRADUAL); } } diff --git a/services/inputflinger/reader/mapper/CursorInputMapper.cpp b/services/inputflinger/reader/mapper/CursorInputMapper.cpp index 887ab53c76..1a4d5517e2 100644 --- a/services/inputflinger/reader/mapper/CursorInputMapper.cpp +++ b/services/inputflinger/reader/mapper/CursorInputMapper.cpp @@ -20,6 +20,7 @@ #include "CursorButtonAccumulator.h" #include "CursorScrollAccumulator.h" +#include "PointerControllerInterface.h" #include "TouchCursorInputMapperCommon.h" namespace android { @@ -154,7 +155,7 @@ void CursorInputMapper::configure(nsecs_t when, const InputReaderConfiguration* mParameters.mode = Parameters::MODE_POINTER_RELATIVE; mSource = AINPUT_SOURCE_MOUSE_RELATIVE; // Keep PointerController around in order to preserve the pointer position. - mPointerController->fade(PointerControllerInterface::TRANSITION_IMMEDIATE); + mPointerController->fade(PointerControllerInterface::Transition::IMMEDIATE); } else { ALOGE("Cannot request pointer capture, device is not in MODE_POINTER"); } @@ -316,7 +317,7 @@ void CursorInputMapper::sync(nsecs_t when) { float yCursorPosition = AMOTION_EVENT_INVALID_CURSOR_POSITION; if (mSource == AINPUT_SOURCE_MOUSE) { if (moved || scrolled || buttonsChanged) { - mPointerController->setPresentation(PointerControllerInterface::PRESENTATION_POINTER); + mPointerController->setPresentation(PointerControllerInterface::Presentation::POINTER); if (moved) { mPointerController->move(deltaX, deltaY); @@ -326,7 +327,7 @@ void CursorInputMapper::sync(nsecs_t when) { mPointerController->setButtonState(currentButtonState); } - mPointerController->unfade(PointerControllerInterface::TRANSITION_IMMEDIATE); + mPointerController->unfade(PointerControllerInterface::Transition::IMMEDIATE); } mPointerController->getPosition(&xCursorPosition, &yCursorPosition); diff --git a/services/inputflinger/reader/mapper/TouchInputMapper.cpp b/services/inputflinger/reader/mapper/TouchInputMapper.cpp index 10b6a180fb..efdc84fd8f 100644 --- a/services/inputflinger/reader/mapper/TouchInputMapper.cpp +++ b/services/inputflinger/reader/mapper/TouchInputMapper.cpp @@ -1383,7 +1383,7 @@ void TouchInputMapper::reset(nsecs_t when) { resetExternalStylus(); if (mPointerController != nullptr) { - mPointerController->fade(PointerControllerInterface::TRANSITION_GRADUAL); + mPointerController->fade(PointerControllerInterface::Transition::GRADUAL); mPointerController->clearSpots(); } @@ -1589,8 +1589,8 @@ void TouchInputMapper::cookAndDispatch(nsecs_t when) { } else { if (mDeviceMode == DEVICE_MODE_DIRECT && mConfig.showTouches && mPointerController != nullptr) { - mPointerController->setPresentation(PointerControllerInterface::PRESENTATION_SPOT); - mPointerController->fade(PointerControllerInterface::TRANSITION_GRADUAL); + mPointerController->setPresentation(PointerControllerInterface::Presentation::SPOT); + mPointerController->fade(PointerControllerInterface::Transition::GRADUAL); mPointerController->setButtonState(mCurrentRawState.buttonState); mPointerController->setSpots(mCurrentCookedState.cookedPointerData.pointerCoords, @@ -2327,7 +2327,7 @@ void TouchInputMapper::dispatchPointerGestures(nsecs_t when, uint32_t policyFlag // Update the pointer presentation and spots. if (mParameters.gestureMode == Parameters::GESTURE_MODE_MULTI_TOUCH) { - mPointerController->setPresentation(PointerControllerInterface::PRESENTATION_POINTER); + mPointerController->setPresentation(PointerControllerInterface::Presentation::POINTER); if (finishPreviousGesture || cancelPreviousGesture) { mPointerController->clearSpots(); } @@ -2339,7 +2339,7 @@ void TouchInputMapper::dispatchPointerGestures(nsecs_t when, uint32_t policyFlag mPointerController->getDisplayId()); } } else { - mPointerController->setPresentation(PointerControllerInterface::PRESENTATION_POINTER); + mPointerController->setPresentation(PointerControllerInterface::Presentation::POINTER); } // Show or hide the pointer if needed. @@ -2349,7 +2349,7 @@ void TouchInputMapper::dispatchPointerGestures(nsecs_t when, uint32_t policyFlag if (mParameters.gestureMode == Parameters::GESTURE_MODE_MULTI_TOUCH && mPointerGesture.lastGestureMode == PointerGesture::FREEFORM) { // Remind the user of where the pointer is after finishing a gesture with spots. - mPointerController->unfade(PointerControllerInterface::TRANSITION_GRADUAL); + mPointerController->unfade(PointerControllerInterface::Transition::GRADUAL); } break; case PointerGesture::TAP: @@ -2360,15 +2360,15 @@ void TouchInputMapper::dispatchPointerGestures(nsecs_t when, uint32_t policyFlag case PointerGesture::SWIPE: // Unfade the pointer when the current gesture manipulates the // area directly under the pointer. - mPointerController->unfade(PointerControllerInterface::TRANSITION_IMMEDIATE); + mPointerController->unfade(PointerControllerInterface::Transition::IMMEDIATE); break; case PointerGesture::FREEFORM: // Fade the pointer when the current gesture manipulates a different // area and there are spots to guide the user experience. if (mParameters.gestureMode == Parameters::GESTURE_MODE_MULTI_TOUCH) { - mPointerController->fade(PointerControllerInterface::TRANSITION_GRADUAL); + mPointerController->fade(PointerControllerInterface::Transition::GRADUAL); } else { - mPointerController->unfade(PointerControllerInterface::TRANSITION_IMMEDIATE); + mPointerController->unfade(PointerControllerInterface::Transition::IMMEDIATE); } break; } @@ -2537,7 +2537,7 @@ void TouchInputMapper::abortPointerGestures(nsecs_t when, uint32_t policyFlags) // Remove any current spots. if (mPointerController != nullptr) { - mPointerController->fade(PointerControllerInterface::TRANSITION_GRADUAL); + mPointerController->fade(PointerControllerInterface::Transition::GRADUAL); mPointerController->clearSpots(); } } @@ -3396,12 +3396,12 @@ void TouchInputMapper::dispatchPointerSimple(nsecs_t when, uint32_t policyFlags, int32_t displayId = mViewport.displayId; if (down || hovering) { - mPointerController->setPresentation(PointerControllerInterface::PRESENTATION_POINTER); + mPointerController->setPresentation(PointerControllerInterface::Presentation::POINTER); mPointerController->clearSpots(); mPointerController->setButtonState(mCurrentRawState.buttonState); - mPointerController->unfade(PointerControllerInterface::TRANSITION_IMMEDIATE); + mPointerController->unfade(PointerControllerInterface::Transition::IMMEDIATE); } else if (!down && !hovering && (mPointerSimple.down || mPointerSimple.hovering)) { - mPointerController->fade(PointerControllerInterface::TRANSITION_GRADUAL); + mPointerController->fade(PointerControllerInterface::Transition::GRADUAL); } displayId = mPointerController->getDisplayId(); |