Connect to Logind's PauseDevice signal

If it emits a "pause" signal, we must acknowledge that we paused the
device.
This commit is contained in:
Martin Gräßlin 2015-04-15 17:54:32 +02:00
parent 2c5337074f
commit 3a9adcac91
2 changed files with 14 additions and 0 deletions

View file

@ -237,6 +237,9 @@ void LogindIntegration::takeControl()
qCDebug(KWIN_CORE) << "Gained session control"; qCDebug(KWIN_CORE) << "Gained session control";
m_sessionControl = true; m_sessionControl = true;
emit hasSessionControlChanged(true); emit hasSessionControlChanged(true);
m_bus.connect(s_login1Service, m_sessionPath,
s_login1SessionInterface, QStringLiteral("PauseDevice"),
this, SLOT(pauseDevice(uint,uint,QString)));
} }
); );
} }
@ -292,4 +295,14 @@ void LogindIntegration::releaseDevice(int fd)
m_bus.asyncCall(message); m_bus.asyncCall(message);
} }
void LogindIntegration::pauseDevice(uint devMajor, uint devMinor, const QString &type)
{
if (QString::compare(type, QStringLiteral("pause"), Qt::CaseInsensitive) == 0) {
// unconditionally call complete
QDBusMessage message = QDBusMessage::createMethodCall(s_login1Service, m_sessionPath, s_login1SessionInterface, QStringLiteral("PauseDeviceComplete"));
message.setArguments(QVariantList({QVariant(devMajor), QVariant(devMinor)}));
m_bus.asyncCall(message);
}
}
} // namespace } // namespace

View file

@ -64,6 +64,7 @@ Q_SIGNALS:
private Q_SLOTS: private Q_SLOTS:
void getSessionActive(); void getSessionActive();
void getVirtualTerminal(); void getVirtualTerminal();
void pauseDevice(uint major, uint minor, const QString &type);
private: private:
friend class LogindTest; friend class LogindTest;