[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/workspace/kdesktop
From: Luboš Luňák <l.lunak () kde ! org>
Date: 2006-09-27 22:05:14
Message-ID: 1159394714.236638.26679.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 589295 by lunakl:
Make "dcop kdesktop KScreensaverIface save; sleep 2; dcop kdesktop KScreensaverIface lock"
actually lock.
M +27 -14 lock/lockprocess.cc
M +1 -1 lock/lockprocess.h
M +9 -5 lockeng.cc
--- trunk/KDE/kdebase/workspace/kdesktop/lock/lockprocess.cc #589294:589295
@@ -189,14 +189,20 @@
}
}
-static int sigterm_pipe[2];
+static int signal_pipe[2];
static void sigterm_handler(int)
{
- char tmp = 0;
- ::write( sigterm_pipe[1], &tmp, 1);
+ char tmp = 'T';
+ ::write( signal_pipe[1], &tmp, 1);
}
+static void sighup_handler(int)
+{
+ char tmp = 'H';
+ ::write( signal_pipe[1], &tmp, 1);
+}
+
void LockProcess::timerEvent(QTimerEvent *ev)
{
if (ev->timerId() == mAutoLogoutTimerId)
@@ -209,13 +215,7 @@
void LockProcess::setupSignals()
{
- // ignore SIGHUP
struct sigaction act;
- act.sa_handler=SIG_IGN;
- sigemptyset(&(act.sa_mask));
- sigaddset(&(act.sa_mask), SIGHUP);
- act.sa_flags = 0;
- sigaction(SIGHUP, &act, 0L);
// ignore SIGINT
act.sa_handler=SIG_IGN;
sigemptyset(&(act.sa_mask));
@@ -234,16 +234,29 @@
sigaddset(&(act.sa_mask), SIGTERM);
act.sa_flags = 0;
sigaction(SIGTERM, &act, 0L);
+ // SIGHUP forces lock
+ act.sa_handler= sighup_handler;
+ sigemptyset(&(act.sa_mask));
+ sigaddset(&(act.sa_mask), SIGHUP);
+ act.sa_flags = 0;
+ sigaction(SIGHUP, &act, 0L);
- pipe(sigterm_pipe);
- QSocketNotifier* notif = new QSocketNotifier(sigterm_pipe[0], QSocketNotifier::Read, this);
- connect( notif, SIGNAL(activated(int)), SLOT(sigtermPipeSignal()));
+ pipe(signal_pipe);
+ QSocketNotifier* notif = new QSocketNotifier(signal_pipe[0], QSocketNotifier::Read, this);
+ connect( notif, SIGNAL(activated(int)), SLOT(signalPipeSignal()));
}
-void LockProcess::sigtermPipeSignal()
+void LockProcess::signalPipeSignal()
{
- quitSaver();
+ char tmp;
+ ::read( signal_pipe[0], &tmp, 1);
+ if( tmp == 'T' )
+ quitSaver();
+ else if( tmp == 'H' ) {
+ if( !mLocked )
+ startLock();
+ }
}
//---------------------------------------------------------------------------
--- trunk/KDE/kdebase/workspace/kdesktop/lock/lockprocess.h #589294:589295
@@ -66,7 +66,7 @@
private Q_SLOTS:
void hackExited(KProcess *);
- void sigtermPipeSignal();
+ void signalPipeSignal();
bool startLock();
void suspend();
void resume();
--- trunk/KDE/kdebase/workspace/kdesktop/lockeng.cc #589294:589295
@@ -80,20 +80,24 @@
if (mState == Waiting)
{
ok = startLockProcess( ForceLock );
- }
// It takes a while for kdesktop_lock to start and lock the screen.
// Therefore delay the DBus call until it tells kdesktop that the locking is in effect.
// This is done only for --forcelock .
- if( ok && mState != Saving )
- {
+ if( ok && mState != Saving )
+ {
#ifdef __GNUC__
#warning port dcop transactions to dbus
#endif
#if 0
- DCOPClientTransaction* trans = kapp->dcopClient()->beginTransaction();
- mLockTransactions.append( trans );
+ DCOPClientTransaction* trans = kapp->dcopClient()->beginTransaction();
+ mLockTransactions.append( trans );
#endif
+ }
}
+ else
+ {
+ mLockProcess.kill( SIGHUP );
+ }
}
void SaverEngine::processLockTransactions()
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic