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

Commit 6d814da3 authored by Ethan Chen's avatar Ethan Chen Committed by Steve Kondik
Browse files

Revert "Add Digital Pen hovering cursor support"

This reverts commit 452395a7.

Change-Id: I56044073a2be926355e6ffe273ad5c014e628d52
parent 8dbc9d82
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -57,12 +57,6 @@
#define MSC_ANDROID_TIME_SEC 0x6
#define MSC_ANDROID_TIME_USEC 0x7

/**
 * code for a special button that is used to show/hide a
 * circular hovering cursor in the input framework.
 */
#define BTN_USF_HOVERING_CURSOR         0x230

namespace android {

enum {
+1 −37
Original line number Diff line number Diff line
@@ -2593,7 +2593,6 @@ void CursorInputMapper::fadePointer() {
TouchInputMapper::TouchInputMapper(InputDevice* device) :
        InputMapper(device),
        mSource(0), mDeviceMode(DEVICE_MODE_DISABLED),
        mHasExternalHoveringCursorControl(false), mExternalHoveringCursorVisible(false),
        mSurfaceWidth(-1), mSurfaceHeight(-1), mSurfaceLeft(0), mSurfaceTop(0),
        mSurfaceOrientation(DISPLAY_ORIENTATION_0) {
}
@@ -2865,8 +2864,6 @@ void TouchInputMapper::configureParameters() {
                        && getDevice()->isExternal();
    }

    mHasExternalHoveringCursorControl = getDevice()->hasKey(BTN_USF_HOVERING_CURSOR);

    // Initial downs on external touch devices should wake the device.
    // Normally we don't do this for internal touch screens to prevent them from waking
    // up in your pocket but you can enable it using the input device configuration.
@@ -3063,7 +3060,7 @@ void TouchInputMapper::configureSurface(nsecs_t when, bool* outResetNeeded) {
    }

    // Create pointer controller if needed.
    if (mDeviceMode == DEVICE_MODE_POINTER || mHasExternalHoveringCursorControl ||
    if (mDeviceMode == DEVICE_MODE_POINTER ||
            (mDeviceMode == DEVICE_MODE_DIRECT && mConfig.showTouches)) {
        if (mPointerController == NULL) {
            mPointerController = getPolicy()->obtainPointerController(getDeviceId());
@@ -3733,20 +3730,6 @@ void TouchInputMapper::process(const RawEvent* rawEvent) {
    if (rawEvent->type == EV_SYN && rawEvent->code == SYN_REPORT) {
        sync(rawEvent->when);
    }
    if (mHasExternalHoveringCursorControl && rawEvent->type == EV_KEY) {
        if (rawEvent->code == BTN_USF_HOVERING_CURSOR && mPointerController != NULL) {
            if (rawEvent->value) {
                // show a hover cursor
                mPointerController->setPresentation(PointerControllerInterface::PRESENTATION_STYLUS_HOVER);
                mPointerController->unfade(android::PointerControllerInterface::TRANSITION_IMMEDIATE);
                mExternalHoveringCursorVisible = true;
            } else {
                // hide the cursor
                mPointerController->fade(android::PointerControllerInterface::TRANSITION_IMMEDIATE);
                mExternalHoveringCursorVisible = false;
            }
        }
    }
}

void TouchInputMapper::sync(nsecs_t when) {
@@ -3878,25 +3861,6 @@ void TouchInputMapper::sync(nsecs_t when) {
                        mCurrentCookedPointerData.touchingIdBits);
            }

            if (mHasExternalHoveringCursorControl && mPointerController != NULL) {
                if (mExternalHoveringCursorVisible) {
                    // find the pointer position from the first touch point (either touching or hovering)
                    uint32_t index = MAX_POINTERS;
                    if (!mCurrentRawPointerData.touchingIdBits.isEmpty()) {
                        index = mCurrentCookedPointerData.idToIndex[mCurrentRawPointerData.touchingIdBits.firstMarkedBit()];
                    } else if (!mCurrentRawPointerData.hoveringIdBits.isEmpty()) {
                        index = mCurrentCookedPointerData.idToIndex[mCurrentRawPointerData.hoveringIdBits.firstMarkedBit()];
                    }
                    if (index < MAX_POINTERS)
                    {
                        float x = mCurrentCookedPointerData.pointerCoords[index].getX();
                        float y = mCurrentCookedPointerData.pointerCoords[index].getY();
                        mPointerController->setPosition(x, y);
                        mPointerController->unfade(android::PointerControllerInterface::TRANSITION_IMMEDIATE);
                    }
                }
            }

            dispatchHoverExit(when, policyFlags);
            dispatchTouches(when, policyFlags);
            dispatchHoverEnterAndMove(when, policyFlags);
+0 −5
Original line number Diff line number Diff line
@@ -1369,11 +1369,6 @@ protected:

    Vector<VirtualKey> mVirtualKeys;

    // true if we support external hovering cursor control
    bool mHasExternalHoveringCursorControl;
    // visibility state of hovering cursor (true=visible)
    bool mExternalHoveringCursorVisible;

    virtual void configureParameters();
    virtual void dumpParameters(String8& dump);
    virtual void configureRawPointerAxes();
+0 −2
Original line number Diff line number Diff line
@@ -79,8 +79,6 @@ public:
        PRESENTATION_POINTER,
        // Show spots and a spot anchor in place of the mouse pointer.
        PRESENTATION_SPOT,
        // Show a stylus hovering icon (small circle)
        PRESENTATION_STYLUS_HOVER,
    };

    /* Sets the mode of the pointer controller. */