From 7a96c3ee46c526b220386811311b78aa35330810 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 27 Mar 2015 14:27:23 +0100 Subject: [PATCH] [input] Disconnect the logind connection once setupLibInput is called Don't want it to be called again if we lose session control. --- input.cpp | 6 +++++- input.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) 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(); };