From kde-commits Fri Oct 05 09:58:47 2012 From: Lukas Tinkl Date: Fri, 05 Oct 2012 09:58:47 +0000 To: kde-commits Subject: [kde-workspace/KDE/4.9] powerdevil/daemon: store the filedescriptor in a member variable Message-Id: <20121005095847.417F6A605D () git ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=134943113909804 Git commit a18b78d7da8cb8d627ad2e85f666bfcf1a2721e1 by Lukas Tinkl. Committed on 05/10/2012 at 11:57. Pushed by lukas into branch 'KDE/4.9'. store the filedescriptor in a member variable make systemd-inhibit work as intended, PowerDevil now handles power/sleep/lid buttons as intended BUG: 307412 M +6 -3 powerdevil/daemon/powerdevilpolicyagent.cpp M +2 -0 powerdevil/daemon/powerdevilpolicyagent.h http://commits.kde.org/kde-workspace/a18b78d7da8cb8d627ad2e85f666bfcf1a2721= e1 diff --git a/powerdevil/daemon/powerdevilpolicyagent.cpp b/powerdevil/daemo= n/powerdevilpolicyagent.cpp index efc3476..70588db 100644 --- a/powerdevil/daemon/powerdevilpolicyagent.cpp +++ b/powerdevil/daemon/powerdevilpolicyagent.cpp @@ -29,7 +29,6 @@ #include #include #include -#include = #include #include @@ -225,6 +224,9 @@ void PolicyAgent::onSessionHandlerRegistered(const QStr= ing & serviceName) onActiveSessionChanged(m_activeSessionPath); = // inhibit systemd handling of power/sleep/lid buttons + // http://www.freedesktop.org/wiki/Software/systemd/inhibit + kDebug() << "fd passing available:" << bool(managerIface.connectio= n().connectionCapabilities() & QDBusConnection::UnixFileDescriptorPassing); + QVariantList args; args << "handle-power-key:handle-suspend-key:handle-hibernate-key:= handle-lid-switch"; // what args << "PowerDevil"; // who @@ -232,8 +234,9 @@ void PolicyAgent::onSessionHandlerRegistered(const QStr= ing & serviceName) args << "block"; // mode QDBusPendingReply desc =3D managerIface.a= syncCallWithArgumentList("Inhibit", args); desc.waitForFinished(); - if (desc.isValid() && desc.value().isValid()) { - kDebug() << "systemd powersave events handling inhibited"; + if (desc.isValid()) { + m_systemdInhibitFd =3D desc.value(); + kDebug() << "systemd powersave events handling inhibited, desc= riptor:" << m_systemdInhibitFd.fileDescriptor(); } else kWarning() << "failed to inhibit systemd powersave handling"; diff --git a/powerdevil/daemon/powerdevilpolicyagent.h b/powerdevil/daemon/= powerdevilpolicyagent.h index 6001846..a046497 100644 --- a/powerdevil/daemon/powerdevilpolicyagent.h +++ b/powerdevil/daemon/powerdevilpolicyagent.h @@ -27,6 +27,7 @@ #include = #include +#include = #include = @@ -108,6 +109,7 @@ private: QString m_activeSessionPath; QWeakPointer< QDBusInterface > m_sdSessionInterface; QWeakPointer< QDBusInterface > m_sdSeatInterface; + QDBusUnixFileDescriptor m_systemdInhibitFd; = // ConsoleKit support bool m_ckAvailable;