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

Commit 0415d63b authored by Michael Wright's avatar Michael Wright
Browse files

Add controller numbers for gamepads / joysticks

Change-Id: I5294aabbadb836a6a4c7ce76a670abcf50c1f885
parent 7ffaa7c6
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -67,10 +67,11 @@ public:
        float resolution;
    };

    void initialize(int32_t id, int32_t generation, const InputDeviceIdentifier& identifier,
            const String8& alias, bool isExternal);
    void initialize(int32_t id, int32_t generation, int32_t controllerNumber,
            const InputDeviceIdentifier& identifier, const String8& alias, bool isExternal);

    inline int32_t getId() const { return mId; }
    inline int32_t getControllerNumber() const { return mControllerNumber; }
    inline int32_t getGeneration() const { return mGeneration; }
    inline const InputDeviceIdentifier& getIdentifier() const { return mIdentifier; }
    inline const String8& getAlias() const { return mAlias; }
@@ -111,6 +112,7 @@ public:
private:
    int32_t mId;
    int32_t mGeneration;
    int32_t mControllerNumber;
    InputDeviceIdentifier mIdentifier;
    String8 mAlias;
    bool mIsExternal;
+8 −9
Original line number Diff line number Diff line
@@ -127,26 +127,25 @@ String8 getInputDeviceConfigurationFilePathByName(
// --- InputDeviceInfo ---

InputDeviceInfo::InputDeviceInfo() {
    initialize(-1, -1, InputDeviceIdentifier(), String8(), false);
    initialize(-1, 0, -1, InputDeviceIdentifier(), String8(), false);
}

InputDeviceInfo::InputDeviceInfo(const InputDeviceInfo& other) :
        mId(other.mId), mGeneration(other.mGeneration), mIdentifier(other.mIdentifier),
        mAlias(other.mAlias), mIsExternal(other.mIsExternal), mSources(other.mSources),
        mKeyboardType(other.mKeyboardType),
        mKeyCharacterMap(other.mKeyCharacterMap),
        mHasVibrator(other.mHasVibrator),
        mHasButtonUnderPad(other.mHasButtonUnderPad),
        mMotionRanges(other.mMotionRanges) {
        mId(other.mId), mGeneration(other.mGeneration), mControllerNumber(other.mControllerNumber),
        mIdentifier(other.mIdentifier), mAlias(other.mAlias), mIsExternal(other.mIsExternal),
        mSources(other.mSources), mKeyboardType(other.mKeyboardType),
        mKeyCharacterMap(other.mKeyCharacterMap), mHasVibrator(other.mHasVibrator),
        mHasButtonUnderPad(other.mHasButtonUnderPad), mMotionRanges(other.mMotionRanges) {
}

InputDeviceInfo::~InputDeviceInfo() {
}

void InputDeviceInfo::initialize(int32_t id, int32_t generation,
void InputDeviceInfo::initialize(int32_t id, int32_t generation, int32_t controllerNumber,
        const InputDeviceIdentifier& identifier, const String8& alias, bool isExternal) {
    mId = id;
    mGeneration = generation;
    mControllerNumber = controllerNumber;
    mIdentifier = identifier;
    mAlias = alias;
    mIsExternal = isExternal;