diff --git a/input.cpp b/input.cpp index f38704a006..0edcfffe6f 100644 --- a/input.cpp +++ b/input.cpp @@ -206,7 +206,7 @@ InputRedirection::InputRedirection(QObject *parent) setupLibInput(); } else { logind->takeControl(); - connect(logind, &LogindIntegration::hasSessionControlChanged, this, &InputRedirection::setupLibInput); + m_sessionControlConnection = connect(logind, &LogindIntegration::hasSessionControlChanged, this, &InputRedirection::setupLibInput); } }; if (logind->isConnected()) { @@ -240,6 +240,10 @@ void InputRedirection::setupLibInput() if (!Application::usesLibinput()) { return; } + if (m_sessionControlConnection) { + disconnect(m_sessionControlConnection); + m_sessionControlConnection = QMetaObject::Connection(); + } LibInput::Connection *conn = LibInput::Connection::create(this); if (conn) { conn->setup(); diff --git a/input.h b/input.h index c49a412b13..8115a2282b 100644 --- a/input.h +++ b/input.h @@ -197,6 +197,8 @@ private: GlobalShortcutsManager *m_shortcuts; + QMetaObject::Connection m_sessionControlConnection; + KWIN_SINGLETON(InputRedirection) friend InputRedirection *input(); };