Add the ability to add InputDevices to InputRedirection

[2/6] Make autotests create fake input devices
This commit is contained in:
Julius Zint 2022-02-26 09:06:32 +01:00 committed by Vlad Zahorodnii
parent 3134198a30
commit 97f49edb1c
2 changed files with 8 additions and 6 deletions

View file

@ -2587,7 +2587,7 @@ void InputRedirection::updateLeds(LEDs leds)
}
}
void InputRedirection::handleInputDeviceAdded(InputDevice *device)
void InputRedirection::addInputDevice(InputDevice *device)
{
connect(device, &InputDevice::keyChanged, m_keyboard, &KeyboardInputRedirection::processKey);
@ -2657,7 +2657,7 @@ void InputRedirection::handleInputDeviceAdded(InputDevice *device)
updateAvailableInputDevices();
}
void InputRedirection::handleInputDeviceRemoved(InputDevice *device)
void InputRedirection::removeInputDevice(InputDevice *device)
{
m_inputDevices.removeOne(device);
Q_EMIT deviceRemoved(device);
@ -2753,8 +2753,8 @@ void InputRedirection::addInputBackend(InputBackend *inputBackend)
Q_ASSERT(!m_inputBackends.contains(inputBackend));
m_inputBackends.append(inputBackend);
connect(inputBackend, &InputBackend::deviceAdded, this, &InputRedirection::handleInputDeviceAdded);
connect(inputBackend, &InputBackend::deviceRemoved, this, &InputRedirection::handleInputDeviceRemoved);
connect(inputBackend, &InputBackend::deviceAdded, this, &InputRedirection::addInputDevice);
connect(inputBackend, &InputBackend::deviceRemoved, this, &InputRedirection::removeInputDevice);
inputBackend->setConfig(InputConfig::self()->inputConfig());
inputBackend->initialize();

View file

@ -287,10 +287,12 @@ Q_SIGNALS:
void hasTouchChanged(bool set);
void hasTabletModeSwitchChanged(bool set);
public Q_SLOTS:
void addInputDevice(InputDevice *device);
void removeInputDevice(InputDevice *device);
private Q_SLOTS:
void handleInputConfigChanged(const KConfigGroup &group);
void handleInputDeviceAdded(InputDevice *device);
void handleInputDeviceRemoved(InputDevice *device);
private:
void setupInputBackends();