From 75ab9920ac2043f45a09dd50763e14f58de9cd65 Mon Sep 17 00:00:00 2001 From: tpearson Date: Tue, 13 Sep 2011 20:23:05 +0000 Subject: Enhance desktop lock process security git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1253276 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kdesktop/lock/lockprocess.cc | 32 ++++++++++++++++++++++++++++++-- kdesktop/lock/lockprocess.h | 2 ++ 2 files changed, 32 insertions(+), 2 deletions(-) (limited to 'kdesktop') diff --git a/kdesktop/lock/lockprocess.cc b/kdesktop/lock/lockprocess.cc index 528fa9cfc..47ff886f3 100644 --- a/kdesktop/lock/lockprocess.cc +++ b/kdesktop/lock/lockprocess.cc @@ -167,6 +167,7 @@ LockProcess::LockProcess(bool child, bool useBlankOnly) resizeTimer(NULL), hackResumeTimer(NULL), mForceContinualLockDisplayTimer(NULL), + mEnsureVRootWindowSecurityTimer(NULL), mHackDelayStartupTimer(NULL), mHackDelayStartupTimeout(0), m_startupStatusDialog(NULL) @@ -182,6 +183,9 @@ LockProcess::LockProcess(bool child, bool useBlankOnly) mHackDelayStartupTimer = new TQTimer( this ); connect( mHackDelayStartupTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(closeDialogAndStartHack()) ); + mEnsureVRootWindowSecurityTimer = new TQTimer( this ); + connect( mEnsureVRootWindowSecurityTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(repaintRootWindowIfNeeded()) ); + mHackDelayStartupTimeout = trinity_desktop_lock_delay_screensaver_start?KDesktopSettings::timeout()*1000:10*1000; // Get root window size @@ -191,8 +195,8 @@ LockProcess::LockProcess(bool child, bool useBlankOnly) mRootWidth = rootAttr.width; mRootHeight = rootAttr.height; { // trigger creation of QToolTipManager, it does XSelectInput() on the root window - TQWidget w; - TQToolTip::add( &w, "foo" ); + TQWidget w; + TQToolTip::add( &w, "foo" ); } XSelectInput( qt_xdisplay(), qt_xrootwin(), SubstructureNotifyMask | rootAttr.your_event_mask ); @@ -278,6 +282,10 @@ LockProcess::~LockProcess() mHackDelayStartupTimer->stop(); delete mHackDelayStartupTimer; } + if (mEnsureVRootWindowSecurityTimer != NULL) { + mEnsureVRootWindowSecurityTimer->stop(); + delete mEnsureVRootWindowSecurityTimer; + } if (greetPlugin.library) { if (greetPlugin.info->done) @@ -1136,8 +1144,28 @@ void LockProcess::closeDialogAndStartHack() } } +void LockProcess::repaintRootWindowIfNeeded() +{ + if (trinity_desktop_lock_use_system_modal_dialogs) { + if (!mHackProc.isRunning()) { + if (backingPixmap.isNull()) { + setBackgroundColor(black); + erase(); + } + else { + bitBlt(this, 0, 0, &backingPixmap); + } + } + if (currentDialog == NULL) { + raise(); + } + } +} + bool LockProcess::startHack() { + if ((mEnsureVRootWindowSecurityTimer) && (!mEnsureVRootWindowSecurityTimer->isActive())) mEnsureVRootWindowSecurityTimer->start(250, FALSE); + if (currentDialog || (!mDialogs.isEmpty())) { // no resuming with dialog visible or when not visible diff --git a/kdesktop/lock/lockprocess.h b/kdesktop/lock/lockprocess.h index d430f393d..88d84dde2 100644 --- a/kdesktop/lock/lockprocess.h +++ b/kdesktop/lock/lockprocess.h @@ -87,6 +87,7 @@ private slots: void displayLockDialogIfNeeded(); void closeDialogAndStartHack(); bool closeCurrentWindow(); + void repaintRootWindowIfNeeded(); private: void configure(); @@ -175,6 +176,7 @@ private: TQDialog *currentDialog; TQTimer* mForceContinualLockDisplayTimer; + TQTimer* mEnsureVRootWindowSecurityTimer; TQTimer* mHackDelayStartupTimer; int mHackDelayStartupTimeout; -- cgit v1.2.1