From 8fd0780faa16abbcf7db9220af1bc333ae484ec8 Mon Sep 17 00:00:00 2001 From: sandman Date: Sun, 04 Aug 2002 02:25:54 +0000 Subject: 1) Fixes for suspend/resume (improved it for iPAQ, shouldn't have changed anything for Z) -- It seems that this also fixes the 70% CPU load problem (needs more testing/feedback though) 2) the launcher now creates a /var/run/opie.pid file containing its pid 3) the launcher catches SIGTERM and kills all its child processes --- (limited to 'core/launcher/desktop.cpp') diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp index f90da1a..7f24259 100644 --- a/core/launcher/desktop.cpp +++ b/core/launcher/desktop.cpp @@ -604,30 +604,40 @@ static void darkScreen() void Desktop::togglePower() { - bool wasloggedin = loggedin; - loggedin=0; - suspendTime = QDateTime::currentDateTime(); - darkScreen(); - if ( wasloggedin ) - blankScreen(); - - system("apm --suspend"); - - - - QWSServer::screenSaverActivate( FALSE ); - { - QCopEnvelope("QPE/Card", "mtabChanged()" ); // might have changed while asleep - QCopEnvelope e("QPE/System", "setBacklight(int)"); - e << -3; // Force on - } - if ( wasloggedin ) { - login(TRUE); - } - sleep(1); - execAutoStart(); - //qcopBridge->closeOpenConnections(); - //qDebug("called togglePower()!!!!!!"); + static bool excllock = false; + + if ( excllock ) + return; + + excllock = true; + + bool wasloggedin = loggedin; + loggedin=0; + suspendTime = QDateTime::currentDateTime(); + darkScreen(); + if ( wasloggedin ) + blankScreen(); + + ODevice::inst ( )-> suspend ( ); + + QWSServer::screenSaverActivate( FALSE ); + + { + QCopEnvelope("QPE/Card", "mtabChanged()" ); // might have changed while asleep + QCopEnvelope e("QPE/System", "setBacklight(int)"); + e << -3; // Force on + } + + if ( wasloggedin ) + login(TRUE); + + execAutoStart(); + //qcopBridge->closeOpenConnections(); + //qDebug("called togglePower()!!!!!!"); + + qApp-> processEvents ( ); + + excllock = false; } void Desktop::toggleLight() -- cgit v0.9.0.2