Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 87099b04 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge changes from topics "pc-enum", "pointer_controller"

* changes:
  Move PointerController enums to enum classes.
  Move PointerController from sp to shared_ptr
parents e8dbb821 e6afda3f
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -332,7 +332,8 @@ public:
    virtual void getReaderConfiguration(InputReaderConfiguration* outConfig) = 0;

    /* Gets a pointer controller associated with the specified cursor device (ie. a mouse). */
    virtual sp<PointerControllerInterface> obtainPointerController(int32_t deviceId) = 0;
    virtual std::shared_ptr<PointerControllerInterface> obtainPointerController(
            int32_t deviceId) = 0;

    /* Notifies the input reader policy that some input devices have changed
     * and provides information about all current input devices.
+7 −7
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ namespace android {
 * The pointer controller is responsible for providing synchronization and for tracking
 * display orientation changes if needed.
 */
class PointerControllerInterface : public virtual RefBase {
class PointerControllerInterface {
protected:
    PointerControllerInterface() { }
    virtual ~PointerControllerInterface() { }
@@ -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. */
+5 −4
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@

#include "CursorButtonAccumulator.h"
#include "CursorScrollAccumulator.h"
#include "PointerControllerInterface.h"
#include "TouchCursorInputMapperCommon.h"

namespace android {
@@ -153,7 +154,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");
            }
@@ -335,7 +336,7 @@ void CursorInputMapper::sync(nsecs_t when) {
    int32_t displayId;
    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);
@@ -345,7 +346,7 @@ void CursorInputMapper::sync(nsecs_t when) {
                mPointerController->setButtonState(currentButtonState);
            }

            mPointerController->unfade(PointerControllerInterface::TRANSITION_IMMEDIATE);
            mPointerController->unfade(PointerControllerInterface::Transition::IMMEDIATE);
        }

        float x, y;
@@ -480,7 +481,7 @@ int32_t CursorInputMapper::getScanCodeState(uint32_t sourceMask, int32_t scanCod

void CursorInputMapper::fadePointer() {
    if (mPointerController != nullptr) {
        mPointerController->fade(PointerControllerInterface::TRANSITION_GRADUAL);
        mPointerController->fade(PointerControllerInterface::Transition::GRADUAL);
    }
}

+1 −1
Original line number Diff line number Diff line
@@ -107,7 +107,7 @@ private:

    int32_t mOrientation;

    sp<PointerControllerInterface> mPointerController;
    std::shared_ptr<PointerControllerInterface> mPointerController;

    int32_t mButtonState;
    nsecs_t mDownTime;
+2 −2
Original line number Diff line number Diff line
@@ -17,12 +17,12 @@
#ifndef _UI_INPUTREADER_TOUCH_CURSOR_INPUT_MAPPER_COMMON_H
#define _UI_INPUTREADER_TOUCH_CURSOR_INPUT_MAPPER_COMMON_H

#include <stdint.h>

#include "EventHub.h"
#include "InputListener.h"
#include "InputReaderContext.h"

#include <stdint.h>

namespace android {

// --- Static Definitions ---
Loading