Katana libraries
Revision | bdccbb17099e41922fcc3ff32a43e6d9db684cdf (tree) |
---|---|
Time | 2022-11-30 09:14:44 |
Author | Ivailo Monev <xakepa10@gmai...> |
Commiter | Ivailo Monev |
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>
@@ -146,6 +146,17 @@ void KPowerManagerImpl::Hibernate() | ||
146 | 146 | } |
147 | 147 | } |
148 | 148 | |
149 | +void KPowerManagerImpl::HybridSuspend() | |
150 | +{ | |
151 | + if (m_login1.isValid()) { | |
152 | + m_login1.asyncCall("HybridSleep", true); | |
153 | + return; | |
154 | + } | |
155 | + if (m_consolekit.isValid()) { | |
156 | + m_consolekit.asyncCall("HybridSleep", true); | |
157 | + } | |
158 | +} | |
159 | + | |
149 | 160 | void KPowerManagerImpl::Suspend() |
150 | 161 | { |
151 | 162 | if (m_login1.isValid()) { |
@@ -38,6 +38,7 @@ public Q_SLOTS: | ||
38 | 38 | bool CanSuspend(); |
39 | 39 | bool GetPowerSaveStatus(); |
40 | 40 | void Hibernate(); |
41 | + void HybridSuspend(); // extension | |
41 | 42 | void Suspend(); |
42 | 43 | |
43 | 44 | Q_SIGNALS: |
@@ -19,6 +19,7 @@ | ||
19 | 19 | |
20 | 20 | <method name="Suspend"/> |
21 | 21 | <method name="Hibernate"/> |
22 | + <method name="HybridSuspend"/> | |
22 | 23 | <method name="CanSuspend"> |
23 | 24 | <arg type="b" name="can_suspend" direction="out"/> |
24 | 25 | </method> |
@@ -110,6 +110,10 @@ void Solid::PowerManagement::requestSleep(SleepState state, QObject *receiver, c | ||
110 | 110 | globalPowerManager()->managerIface->asyncCall("Hibernate"); |
111 | 111 | break; |
112 | 112 | } |
113 | + case HybridSuspendState: { | |
114 | + globalPowerManager()->managerIface->asyncCall("HybridSuspend"); | |
115 | + break; | |
116 | + } | |
113 | 117 | } |
114 | 118 | } |
115 | 119 |