From 3a9adcac9139ec46d930fc97cf2fd8eb9afac8a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Wed, 15 Apr 2015 17:54:32 +0200 Subject: [PATCH] Connect to Logind's PauseDevice signal If it emits a "pause" signal, we must acknowledge that we paused the device. --- logind.cpp | 13 +++++++++++++ logind.h | 1 + 2 files changed, 14 insertions(+) diff --git a/logind.cpp b/logind.cpp index 0a2c356ac0..22a86cdfce 100644 --- a/logind.cpp +++ b/logind.cpp @@ -237,6 +237,9 @@ void LogindIntegration::takeControl() qCDebug(KWIN_CORE) << "Gained session control"; m_sessionControl = 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); } +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 diff --git a/logind.h b/logind.h index 7165990938..9a3f4563a8 100644 --- a/logind.h +++ b/logind.h @@ -64,6 +64,7 @@ Q_SIGNALS: private Q_SLOTS: void getSessionActive(); void getVirtualTerminal(); + void pauseDevice(uint major, uint minor, const QString &type); private: friend class LogindTest;