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

Commit dd75da12 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira
Browse files

libui: Limit slider state to input devices that are actual keyboards

Change I6a6a18d0b09d0 ("modify the device to enable to get the
state as slide-open/slide-close.") caused issues on devices running
kernels that announced evdev switches for inputs other than keyboards
(headsets, for instance), which are open by default.

By generically treating an open switch as a keyboard presence
indicator, this change was causing devices with these switches to be
stuck in keyboard mode (i.e., landscape w/o rotation). So... limit
the new logic to alpha-keyboard inputs only

Change-Id: Id180598775288b9e60386c18d68d69e6fb90632d
parent ce79ca62
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -551,10 +551,16 @@ int32_t InputReader::getState(int32_t deviceId, uint32_t sourceMask, int32_t cod
            size_t numDevices = mDevices.size();
            for (size_t i = 0; i < numDevices; i++) {
                InputDevice* device = mDevices.valueAt(i);
                InputDeviceInfo deviceInfo;
                bool isKeyboard = false;
                device->getDeviceInfo( &deviceInfo );
                isKeyboard = (deviceInfo.getKeyboardType() == AINPUT_KEYBOARD_TYPE_ALPHABETIC);
                if (! device->isIgnored() && sourcesMatchMask(device->getSources(), sourceMask)) {
                    int32_t state = (device->*getStateFunc)(sourceMask, code);
                    if (state > result) {
                    if (isKeyboard && state > result) {
                        result = state;
                    } else if ( state >= AKEY_STATE_DOWN ) {
                        return state;
                    }
                }
            }