File suspend-lock.diff of Package kdebase4-workspace

Subject: Use Solid suspend method that also locks screen
From: Lubos Lunak
Bug: bnc#326848
Patch-upstream: No

I don't understand what the difference between the two Solid suspend methods
is (or even why there are two), but the one ksmserver in 4.1 uses does not
lock the screen, and this one does.

--- ksmserver/shutdowndlg.cpp.sav	2008-11-14 16:29:14.000000000 +0100
+++ ksmserver/shutdowndlg.cpp	2008-11-20 10:54:40.000000000 +0100
@@ -43,6 +43,7 @@
 #include <kiconloader.h>
 #include <klocale.h>
 #include <kuser.h>
+#include <solid/powermanagement.h>
 #include <solid/control/powermanager.h>
 #include <kwindowsystem.h>
 #include <netwm.h>
@@ -607,9 +608,16 @@
 {
     m_bootOption.clear();
     Solid::Control::PowerManager::SuspendMethod spdMethod = action->data().value<Solid::Control::PowerManager::SuspendMethod>();
+    if( spdMethod == Solid::Control::PowerManager::ToRam )
+        Solid::PowerManagement::requestSleep(Solid::PowerManagement::SuspendState,0,0);
+    else if( spdMethod == Solid::Control::PowerManager::ToDisk )
+        Solid::PowerManagement::requestSleep(Solid::PowerManagement::HibernateState,0,0);
+    else
+    {
     KJob *job = Solid::Control::PowerManager::suspend( spdMethod );
     if (job != 0)
        job->start();
+    }
     reject();
 }
 
openSUSE Build Service is sponsored by