generic: implement hybrid suspend/sleep method

marking as extension because it was not implemented before and the FDO
spec is dead (i.e. not a spec anymore), may or may not work with other
power managers implementing the interface (org.freedesktop.PowerManagement)

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-11-30 02:07:36 +02:00
parent c06770a96f
commit bdccbb1709
4 changed files with 17 additions and 0 deletions

View file

@ -146,6 +146,17 @@ void KPowerManagerImpl::Hibernate()
}
}
void KPowerManagerImpl::HybridSuspend()
{
if (m_login1.isValid()) {
m_login1.asyncCall("HybridSleep", true);
return;
}
if (m_consolekit.isValid()) {
m_consolekit.asyncCall("HybridSleep", true);
}
}
void KPowerManagerImpl::Suspend()
{
if (m_login1.isValid()) {

View file

@ -38,6 +38,7 @@ public Q_SLOTS:
bool CanSuspend();
bool GetPowerSaveStatus();
void Hibernate();
void HybridSuspend(); // extension
void Suspend();
Q_SIGNALS:

View file

@ -19,6 +19,7 @@
<method name="Suspend"/>
<method name="Hibernate"/>
<method name="HybridSuspend"/>
<method name="CanSuspend">
<arg type="b" name="can_suspend" direction="out"/>
</method>

View file

@ -110,6 +110,10 @@ void Solid::PowerManagement::requestSleep(SleepState state, QObject *receiver, c
globalPowerManager()->managerIface->asyncCall("Hibernate");
break;
}
case HybridSuspendState: {
globalPowerManager()->managerIface->asyncCall("HybridSuspend");
break;
}
}
}