[input] Disconnect the logind connection once setupLibInput is called

Don't want it to be called again if we lose session control.
This commit is contained in:
Martin Gräßlin 2015-03-27 14:27:23 +01:00
parent 26c44a6524
commit 7a96c3ee46
2 changed files with 7 additions and 1 deletions

View file

@ -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();

View file

@ -197,6 +197,8 @@ private:
GlobalShortcutsManager *m_shortcuts;
QMetaObject::Connection m_sessionControlConnection;
KWIN_SINGLETON(InputRedirection)
friend InputRedirection *input();
};