backends/libinput: update screens on Workspace::outputsChanged

Using OutputBackend::outputsQueried can cause problems because it's emitted
before output settings like enablement get adjusted to the new output configuration.
It also doesn't react to output changes initiated by KScreen and is in the
way of plans to use multiple output backends at the same time.

BUG: 461901
This commit is contained in:
Xaver Hugl 2022-11-19 15:10:15 +01:00
parent acb25fbd5e
commit cdeacdbdad
6 changed files with 19 additions and 1 deletions

View file

@ -136,7 +136,6 @@ void Connection::doSetup()
deactivate(); deactivate();
} }
}); });
connect(kwinApp()->outputBackend(), &OutputBackend::outputsQueried, this, &Connection::updateScreens);
handleEvent(); handleEvent();
} }

View file

@ -46,4 +46,9 @@ void LibinputBackend::initialize()
m_connection->setup(); m_connection->setup();
} }
void LibinputBackend::updateScreens()
{
m_connection->updateScreens();
}
} // namespace KWin } // namespace KWin

View file

@ -29,6 +29,7 @@ public:
~LibinputBackend() override; ~LibinputBackend() override;
void initialize() override; void initialize() override;
void updateScreens() override;
private: private:
QThread m_thread; QThread m_thread;

View file

@ -31,6 +31,10 @@ public:
{ {
} }
virtual void updateScreens()
{
}
Q_SIGNALS: Q_SIGNALS:
void deviceAdded(InputDevice *device); void deviceAdded(InputDevice *device);
void deviceRemoved(InputDevice *device); void deviceRemoved(InputDevice *device);

View file

@ -2588,6 +2588,7 @@ void InputRedirection::init()
void InputRedirection::setupWorkspace() void InputRedirection::setupWorkspace()
{ {
connect(workspace(), &Workspace::outputsChanged, this, &InputRedirection::updateScreens);
if (waylandServer()) { if (waylandServer()) {
m_keyboard->init(); m_keyboard->init();
m_pointer->init(); m_pointer->init();
@ -2602,6 +2603,13 @@ void InputRedirection::setupWorkspace()
} }
} }
void InputRedirection::updateScreens()
{
for (const auto &backend : m_inputBackends) {
backend->updateScreens();
}
}
QObject *InputRedirection::lastInputHandler() const QObject *InputRedirection::lastInputHandler() const
{ {
return m_lastInputDevice; return m_lastInputDevice;

View file

@ -302,6 +302,7 @@ public Q_SLOTS:
private Q_SLOTS: private Q_SLOTS:
void handleInputConfigChanged(const KConfigGroup &group); void handleInputConfigChanged(const KConfigGroup &group);
void updateScreens();
private: private:
void setupInputBackends(); void setupInputBackends();