summaryrefslogtreecommitdiffstats
path: root/kdesktop/krootwm.cc
diff options
context:
space:
mode:
Diffstat (limited to 'kdesktop/krootwm.cc')
-rw-r--r--kdesktop/krootwm.cc72
1 files changed, 10 insertions, 62 deletions
diff --git a/kdesktop/krootwm.cc b/kdesktop/krootwm.cc
index 756d0b5b5..d12e024ab 100644
--- a/kdesktop/krootwm.cc
+++ b/kdesktop/krootwm.cc
@@ -60,6 +60,7 @@
#include "desktop.h"
#include "kcustommenu.h"
#include "kdesktopsettings.h"
+#include "lockeng.h"
#include <netwm.h>
#include <X11/X.h>
@@ -71,21 +72,11 @@ KRootWm * KRootWm::s_rootWm = 0;
extern TQCString kdesktop_name, kicker_name, twin_name;
-KRootWm::KRootWm(KDesktop* _desktop) : TQObject(_desktop), startup(FALSE)
+KRootWm::KRootWm(SaverEngine* _saver, KDesktop* _desktop) : TQObject(_desktop), startup(FALSE)
{
- m_helperThread = new TQEventLoopThread;
- m_helperThread->start();
- m_threadHelperObject = new KRootWmThreadHelperObject;
- m_threadHelperObject->moveToThread(m_helperThread);
- connect(this, TQT_SIGNAL(initializeHelperThread()), m_threadHelperObject, TQT_SLOT(initializeThread()));
- connect(this, TQT_SIGNAL(terminateHelperThread()), m_threadHelperObject, TQT_SLOT(terminateThread()));
- connect(this, TQT_SIGNAL(asyncLock()), m_threadHelperObject, TQT_SLOT(slotLock()));
- connect(this, TQT_SIGNAL(asyncLockAndDoNewSession()), m_threadHelperObject, TQT_SLOT(lockAndDoNewSession()));
- connect(this, TQT_SIGNAL(asyncSlotSessionActivated(int)), m_threadHelperObject, TQT_SLOT(slotSessionActivated(int)));
- initializeHelperThread();
-
s_rootWm = this;
m_actionCollection = new TDEActionCollection(_desktop, this, "KRootWm::m_actionCollection");
+ m_pSaver = _saver;
m_pDesktop = _desktop;
m_bDesktopEnabled = (m_pDesktop->iconView() != 0);
customMenu1 = 0;
@@ -226,11 +217,6 @@ KRootWm::KRootWm(KDesktop* _desktop) : TQObject(_desktop), startup(FALSE)
KRootWm::~KRootWm()
{
- terminateHelperThread();
- m_helperThread->wait();
- delete m_threadHelperObject;
- delete m_helperThread;
-
delete m_actionCollection;
delete desktopMenu;
delete windowListMenu;
@@ -838,7 +824,8 @@ void KRootWm::slotCascadeWindows() {
void KRootWm::slotLock() {
- asyncLock();
+ m_pSaver->lockScreen();
+ m_pSaver->waitForLockEngage();
}
@@ -882,49 +869,10 @@ void KRootWm::slotPopulateSessions()
}
}
-void KRootWmThreadHelperObject::initializeThread() {
- // Prevent kdesktop_lock signals from being handled by the wrong (non-GUI) thread
- sigset_t set;
- sigemptyset(&set);
- sigaddset(&set, SIGUSR1);
- sigaddset(&set, SIGUSR2);
- sigaddset(&set, SIGTTIN);
- pthread_sigmask(SIG_BLOCK, &set, NULL);
-}
-
-void KRootWmThreadHelperObject::terminateThread() {
- TQEventLoop* eventLoop = TQApplication::eventLoop();
- if (eventLoop) {
- eventLoop->exit(0);
- }
-}
-
-void KRootWmThreadHelperObject::slotLock() {
- // Block here until lock is complete
- // If this is not done the desktop of the locked session will be shown after VT switch until the lock fully engages!
- // Force remote call to ensure that blocking is enforced even though this call is being made from inside the kdesktop_name application...
- // If this is not done DCOP will translate the call into a send and the desktop of the locked session will be shown after VT switch as above
- system("dcop kdesktop KScreensaverIface lock");
-}
-
-void KRootWmThreadHelperObject::lockAndDoNewSession() {
- // Block here until lock is complete
- // If this is not done the desktop of the locked session will be shown after VT switch until the lock fully engages!
- // Force remote call to ensure that blocking is enforced even though this call is being made from inside the kdesktop_name application...
- // If this is not done DCOP will translate the call into a send and the desktop of the locked session will be shown after VT switch as above
- if (system("dcop kdesktop KScreensaverIface lock") == 0) {
- DM().startReserve();
- }
-}
-
-void KRootWmThreadHelperObject::slotSessionActivated(int vt) {
- DM().lockSwitchVT( vt );
-}
-
void KRootWm::slotSessionActivated( int ent )
{
if (ent > 0 && !sessionsMenu->isItemChecked( ent )) {
- asyncSlotSessionActivated( ent );
+ DM().lockSwitchVT( ent );
}
}
@@ -962,11 +910,11 @@ void KRootWm::doNewSession( bool lock )
return;
if (lock) {
- asyncLockAndDoNewSession();
- }
- else {
- DM().startReserve();
+ m_pSaver->lockScreen();
+ m_pSaver->waitForLockEngage();
}
+
+ DM().startReserve();
}
void KRootWm::slotMenuItemActivated(int /* item */ )