Bugzilla – Attachment 49378 Details for
Bug 115123
KDE - lock screen before suspend/standby
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
IDP Log In
|
Forgot Password
[patch]
kdebase patch
kdesktop.patch (text/plain), 5.88 KB, created by
Lubos Lunak
on 2005-09-09 12:57:19 UTC
(
hide
)
Description:
kdebase patch
Filename:
MIME Type:
Creator:
Lubos Lunak
Created:
2005-09-09 12:57:19 UTC
Size:
5.88 KB
patch
obsolete
>--- kdesktop/lock/main.cc.sav 2005-07-18 17:05:54.000000000 +0200 >+++ kdesktop/lock/main.cc 2005-09-09 14:46:05.000000000 +0200 >@@ -27,6 +27,7 @@ > #include <kglobal.h> > #include <kdebug.h> > #include <kglobalsettings.h> >+#include <dcopref.h> > > #include <stdlib.h> > >@@ -148,8 +149,12 @@ int main( int argc, char **argv ) > process.setParent(parent_connection); > > bool rt; >+ bool sig = false; > if( !child && args->isSet( "forcelock" )) >+ { > rt = process.lock(); >+ sig = true; >+ } > else if( child || args->isSet( "dontlock" )) > rt = process.dontLock(); > else >@@ -157,6 +162,12 @@ int main( int argc, char **argv ) > if (!rt) > return 1; > >+ if( sig ) >+ { >+ DCOPRef ref( "kdesktop", "KScreensaverIface"); >+ ref.send( "saverLockReady" ); >+ } >+ > return app.exec(); > } > >--- kdesktop/lockeng.cc.sav 2005-05-04 15:53:20.000000000 +0200 >+++ kdesktop/lockeng.cc 2005-09-09 14:38:07.000000000 +0200 >@@ -16,6 +16,7 @@ > #include <kdebug.h> > #include <klocale.h> > #include <qfile.h> >+#include <dcopclient.h> > #include <assert.h> > > #include "lockeng.h" >@@ -85,12 +86,46 @@ SaverEngine::~SaverEngine() > } > > //--------------------------------------------------------------------------- >+ >+// This should be called only using DCOP. > void SaverEngine::lock() > { >+ bool ok = true; > if (mState == Waiting) > { >- startLockProcess( ForceLock ); >+ ok = startLockProcess( ForceLock ); >+ } >+// It takes a while for kdesktop_lock to start and lock the screen. >+// Therefore delay the DCOP call until it tells kdesktop that the locking is in effect. >+// This is done only for --forcelock . >+ if( ok && mState != Saving ) >+ { >+ DCOPClientTransaction* trans = kapp->dcopClient()->beginTransaction(); >+ mLockTransactions.append( trans ); >+ } >+} >+ >+void SaverEngine::processLockTransactions() >+{ >+ for( QValueVector< DCOPClientTransaction* >::ConstIterator it = mLockTransactions.begin(); >+ it != mLockTransactions.end(); >+ ++it ) >+ { >+ QCString replyType = "void"; >+ QByteArray arr; >+ kapp->dcopClient()->endTransaction( *it, replyType, arr ); > } >+ mLockTransactions.clear(); >+} >+ >+void SaverEngine::saverLockReady() >+{ >+ if( mState != Preparing ) >+ { >+ kdDebug( 1204 ) << "Got unexpected saverReady()" << endl; >+ } >+ kdDebug( 1204 ) << "Saver Lock Ready" << endl; >+ processLockTransactions(); > } > > //--------------------------------------------------------------------------- >@@ -105,7 +140,7 @@ void SaverEngine::save() > //--------------------------------------------------------------------------- > void SaverEngine::quit() > { >- if (mState == Saving) >+ if (mState == Saving || mState == Preparing) > { > stopLockProcess(); > } >@@ -213,12 +248,12 @@ void SaverEngine::setBlankOnly( bool bla > // > // Start the screen saver. > // >-void SaverEngine::startLockProcess( LockType lock_type ) >+bool SaverEngine::startLockProcess( LockType lock_type ) > { > if (mState != Waiting) > { > kdWarning(1204) << "SaverEngine::startSaver() saver already active" << endl; >- return; >+ return true; > } > > kdDebug(1204) << "SaverEngine: starting saver" << endl; >@@ -233,7 +268,7 @@ void SaverEngine::startLockProcess( Lock > if( path.isEmpty()) > { > kdDebug( 1204 ) << "Can't find kdesktop_lock!" << endl; >- return; >+ return false; > } > mLockProcess << path; > switch( lock_type ) >@@ -253,14 +288,15 @@ void SaverEngine::startLockProcess( Lock > if (mLockProcess.start() == false ) > { > kdDebug( 1204 ) << "Failed to start kdesktop_lock!" << endl; >- return; >+ return false; > } > >- mState = Saving; >+ mState = Preparing; > if (mXAutoLock) > { > mXAutoLock->stop(); > } >+ return true; > } > > //--------------------------------------------------------------------------- >@@ -284,6 +320,7 @@ void SaverEngine::stopLockProcess() > { > mXAutoLock->start(); > } >+ processLockTransactions(); > mState = Waiting; > } > >@@ -297,6 +334,7 @@ void SaverEngine::lockProcessExited() > { > mXAutoLock->start(); > } >+ processLockTransactions(); > mState = Waiting; > } > >--- kdesktop/lockeng.h.sav 2005-05-04 15:53:20.000000000 +0200 >+++ kdesktop/lockeng.h 2005-09-09 14:31:53.000000000 +0200 >@@ -10,10 +10,13 @@ > > #include <qwidget.h> > #include <kprocess.h> >+#include <qvaluevector.h> > #include "KScreensaverIface.h" > #include "xautolock.h" > #include "xautolock_c.h" > >+class DCOPClientTransaction; >+ > //=========================================================================== > /** > * Screen saver engine. Handles screensaver window, starting screensaver >@@ -70,19 +73,25 @@ public: > */ > virtual void setBlankOnly( bool blankOnly ); > >+ /** >+ * Called by kdesktop_lock when locking is in effect. >+ */ >+ virtual void saverLockReady(); >+ > protected slots: > void idleTimeout(); > void lockProcessExited(); > > protected: > enum LockType { DontLock, DefaultLock, ForceLock }; >- void startLockProcess( LockType lock_type ); >+ bool startLockProcess( LockType lock_type ); > void stopLockProcess(); > bool handleKeyPress(XKeyEvent *xke); >+ void processLockTransactions(); > xautolock_corner_t applyManualSettings(int); > > protected: >- enum State { Waiting, Saving }; >+ enum State { Waiting, Preparing, Saving }; > bool mEnabled; > bool mDPMS; > >@@ -98,6 +107,7 @@ protected: > int mXExposures; > > bool mBlankOnly; // only use the blanker, not the defined saver >+ QValueVector< DCOPClientTransaction* > mLockTransactions; > }; > > #endif >--- kdesktop/KScreensaverIface.h.sav 2005-05-04 15:53:20.000000000 +0200 >+++ kdesktop/KScreensaverIface.h 2005-09-09 14:31:00.000000000 +0200 >@@ -40,7 +40,10 @@ k_dcop: > */ > virtual void setBlankOnly( bool blankOnly ) = 0; > >+ /*** >+ * @internal >+ */ >+ virtual void saverLockReady() = 0; > }; > > #endif >-
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 115123
: 49378