summaryrefslogtreecommitdiffstats
path: root/kdesktop
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2012-05-20 18:22:04 -0500
committerTimothy Pearson <[email protected]>2012-05-20 18:22:04 -0500
commit193d9afcdb186902317c5bef5d6c769fc8933f1a (patch)
tree7634b1ddfbef08527a9fc55841ccbbdac2de7cae /kdesktop
parent2f2f32d31cb1548defcd7aa84187ac7df6479cce (diff)
downloadtdebase-193d9afcdb186902317c5bef5d6c769fc8933f1a.tar.gz
tdebase-193d9afcdb186902317c5bef5d6c769fc8933f1a.zip
Fix desktop lock not engaging on suspend
This closes Bug 1003
Diffstat (limited to 'kdesktop')
-rw-r--r--kdesktop/lock/main.cc4
-rw-r--r--kdesktop/lockeng.cc46
-rw-r--r--kdesktop/lockeng.h6
3 files changed, 54 insertions, 2 deletions
diff --git a/kdesktop/lock/main.cc b/kdesktop/lock/main.cc
index a28d88330..7adbd5745 100644
--- a/kdesktop/lock/main.cc
+++ b/kdesktop/lock/main.cc
@@ -331,6 +331,10 @@ int main( int argc, char **argv )
}
else {
pid_t kdesktop_pid = atoi(args->getOption( "internal" ));
+ if (kill(kdesktop_pid, SIGUSR2) < 0) {
+ // The controlling kdesktop process probably died. Commit suicide...
+ return 12;
+ }
app.exec();
if (kill(kdesktop_pid, SIGUSR1) < 0) {
// The controlling kdesktop process probably died. Commit suicide...
diff --git a/kdesktop/lockeng.cc b/kdesktop/lockeng.cc
index f24d02f9f..553f0ce4c 100644
--- a/kdesktop/lockeng.cc
+++ b/kdesktop/lockeng.cc
@@ -37,6 +37,12 @@ static void sigusr1_handler(int)
m_masterSaverEngine->slotLockProcessWaiting();
}
}
+static void sigusr2_handler(int)
+{
+ if (m_masterSaverEngine) {
+ m_masterSaverEngine->slotLockProcessFullyActivated();
+ }
+}
//===========================================================================
//
@@ -61,6 +67,14 @@ SaverEngine::SaverEngine()
act.sa_flags = 0;
sigaction(SIGUSR1, &act, 0L);
+ // handle SIGUSR2
+ m_masterSaverEngine = this;
+ act.sa_handler= sigusr2_handler;
+ sigemptyset(&(act.sa_mask));
+ sigaddset(&(act.sa_mask), SIGUSR2);
+ act.sa_flags = 0;
+ sigaction(SIGUSR2, &act, 0L);
+
// Save X screensaver parameters
XGetScreenSaver(tqt_xdisplay(), &mXTimeout, &mXInterval,
&mXBlanking, &mXExposures);
@@ -118,7 +132,7 @@ SaverEngine::~SaverEngine()
void SaverEngine::lock()
{
bool ok = true;
- if (mState == Waiting)
+ if (mState != Saving)
{
mSAKProcess->kill(SIGTERM);
ok = startLockProcess( ForceLock );
@@ -237,6 +251,27 @@ bool SaverEngine::isBlanked()
return (mState != Waiting);
}
+void SaverEngine::enableExports()
+{
+#ifdef Q_WS_X11
+ kdDebug(270) << k_lineinfo << "activating background exports.\n";
+ DCOPClient *client = kapp->dcopClient();
+ if (!client->isAttached()) {
+ client->attach();
+ }
+ TQByteArray data;
+ TQDataStream args( data, IO_WriteOnly );
+ args << 1;
+
+ TQCString appname( "kdesktop" );
+ int screen_number = DefaultScreen(tqt_xdisplay());
+ if ( screen_number )
+ appname.sprintf("kdesktop-screen-%d", screen_number );
+
+ client->send( appname, "KBackgroundIface", "setExport(int)", data );
+#endif
+}
+
//---------------------------------------------------------------------------
void SaverEngine::handleSecureDialog()
{
@@ -316,9 +351,11 @@ void SaverEngine::setBlankOnly( bool blankOnly )
//
bool SaverEngine::startLockProcess( LockType lock_type )
{
- if (mState != Waiting)
+ if (mState == Saving)
return true;
+ enableExports();
+
kdDebug(1204) << "SaverEngine: starting saver" << endl;
emitDCOPSignal("KDE_start_screensaver()", TQByteArray());
@@ -452,6 +489,11 @@ void SaverEngine::slotLockProcessWaiting()
TQTimer::singleShot(0, this, SLOT(lockProcessWaiting()));
}
+void SaverEngine::slotLockProcessFullyActivated()
+{
+ mState = Saving;
+}
+
void SaverEngine::lockProcessWaiting()
{
kdDebug(1204) << "SaverEngine: lock exited" << endl;
diff --git a/kdesktop/lockeng.h b/kdesktop/lockeng.h
index e42a048bb..d1133aae6 100644
--- a/kdesktop/lockeng.h
+++ b/kdesktop/lockeng.h
@@ -80,6 +80,7 @@ public:
public slots:
void slotLockProcessWaiting();
+ void slotLockProcessFullyActivated();
protected slots:
void idleTimeout();
@@ -90,6 +91,11 @@ private slots:
void handleSecureDialog();
void slotSAKProcessExited();
+ /**
+ * Enable wallpaper exports
+ */
+ void enableExports();
+
protected:
enum LockType { DontLock, DefaultLock, ForceLock, SecureDialog };
bool startLockProcess( LockType lock_type );