Fix desktop lock startup sequence appearance

git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1253084 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 13 years ago
parent 06f2c11087
commit 7bab23c1ca

@ -41,6 +41,7 @@
#include <kpixmap.h> #include <kpixmap.h>
#include <kwin.h> #include <kwin.h>
#include <kwinmodule.h> #include <kwinmodule.h>
#include <kdialog.h>
#include <tqframe.h> #include <tqframe.h>
#include <tqlabel.h> #include <tqlabel.h>
@ -53,6 +54,7 @@
#include <tqtooltip.h> #include <tqtooltip.h>
#include <tqimage.h> #include <tqimage.h>
#include <tqregexp.h> #include <tqregexp.h>
#include <tqpainter.h>
#include <tqdatetime.h> #include <tqdatetime.h>
@ -166,7 +168,8 @@ LockProcess::LockProcess(bool child, bool useBlankOnly)
hackResumeTimer(NULL), hackResumeTimer(NULL),
mForceContinualLockDisplayTimer(NULL), mForceContinualLockDisplayTimer(NULL),
mHackDelayStartupTimer(NULL), mHackDelayStartupTimer(NULL),
mHackDelayStartupTimeout(0) mHackDelayStartupTimeout(0),
m_startupStatusDialog(NULL)
{ {
setupSignals(); setupSignals();
setupPipe(); setupPipe();
@ -300,6 +303,21 @@ static void sighup_handler(int)
::write( signal_pipe[1], &tmp, 1); ::write( signal_pipe[1], &tmp, 1);
} }
bool LockProcess::closeCurrentWindow()
{
if (currentDialog != NULL) {
mForceReject = true;
currentDialog->close();
}
if( mDialogs.isEmpty() ) {
return false;
}
else {
return true;
}
}
void LockProcess::timerEvent(TQTimerEvent *ev) void LockProcess::timerEvent(TQTimerEvent *ev)
{ {
if (mAutoLogout && ev->timerId() == mAutoLogoutTimerId) if (mAutoLogout && ev->timerId() == mAutoLogoutTimerId)
@ -749,9 +767,9 @@ void LockProcess::doDesktopResizeFinish()
while (mDialogControlLock == true) sleep(1); while (mDialogControlLock == true) sleep(1);
mDialogControlLock = true; mDialogControlLock = true;
if (currentDialog != NULL) { if (closeCurrentWindow()) {
mForceReject = true; TQTimer::singleShot( 0, this, SLOT(doDesktopResizeFinish()) );
currentDialog->close(); mDialogControlLock = false;
} }
mDialogControlLock = false; mDialogControlLock = false;
@ -955,6 +973,27 @@ bool LockProcess::startSaver()
} }
mBusy = false; mBusy = false;
// eliminate nasty flicker on first show
TQImage m_grayImage = TQImage( TQApplication::desktop()->width(), TQApplication::desktop()->height(), 32 );
m_grayImage = m_grayImage.convertDepth(32);
m_grayImage.setAlphaBuffer(false);
m_grayImage.fill(0); // Set the alpha buffer to 0 (fully transparent)
m_grayImage.setAlphaBuffer(true);
TQPixmap m_root;
m_root.resize( TQApplication::desktop()->geometry().width(), TQApplication::desktop()->geometry().height() );
TQPainter p;
p.begin( &m_root );
m_grayImage.setAlphaBuffer(false);
p.drawImage( 0, 0, m_grayImage );
p.end();
setBackgroundPixmap( m_root );
m_startupStatusDialog = new KSMModalDialog(this);
m_startupStatusDialog->setStatusMessage(i18n("Securing desktop session").append("..."));
m_startupStatusDialog->show();
m_startupStatusDialog->setActiveWindow();
tqApp->processEvents();
saveVRoot(); saveVRoot();
if (mParent) { if (mParent) {
@ -1092,15 +1131,14 @@ void LockProcess::closeDialogAndStartHack()
// Close any active dialogs // Close any active dialogs
DISABLE_CONTINUOUS_LOCKDLG_DISPLAY DISABLE_CONTINUOUS_LOCKDLG_DISPLAY
mSuspended = true; mSuspended = true;
if (currentDialog != NULL) { if (closeCurrentWindow()) {
mForceReject = true; TQTimer::singleShot( 0, this, SLOT(closeDialogAndStartHack()) );
currentDialog->close();
} }
} }
bool LockProcess::startHack() bool LockProcess::startHack()
{ {
if (currentDialog) if (currentDialog || (!mDialogs.isEmpty()))
{ {
return false; return false;
} }
@ -1160,11 +1198,11 @@ bool LockProcess::startHack()
DISABLE_CONTINUOUS_LOCKDLG_DISPLAY DISABLE_CONTINUOUS_LOCKDLG_DISPLAY
if (trinity_desktop_lock_delay_screensaver_start && trinity_desktop_lock_forced) { if (trinity_desktop_lock_delay_screensaver_start && trinity_desktop_lock_forced) {
// Close any active dialogs // Close any active dialogs
if (currentDialog != NULL) { if (closeCurrentWindow()) {
mForceReject = true; TQTimer::singleShot( 0, this, SLOT(closeCurrentWindow()) );
currentDialog->close();
} }
} }
if (m_startupStatusDialog) { m_startupStatusDialog->closeSMDialog(); m_startupStatusDialog=NULL; }
return true; return true;
} }
} }
@ -1187,6 +1225,7 @@ bool LockProcess::startHack()
} }
} }
} }
if (m_startupStatusDialog) { m_startupStatusDialog->closeSMDialog(); m_startupStatusDialog=NULL; }
return false; return false;
} }
@ -1229,6 +1268,7 @@ void LockProcess::hackExited(KProcess *)
void LockProcess::displayLockDialogIfNeeded() void LockProcess::displayLockDialogIfNeeded()
{ {
if (m_startupStatusDialog) { m_startupStatusDialog->closeSMDialog(); m_startupStatusDialog=NULL; }
if (trinity_desktop_lock_use_system_modal_dialogs) { if (trinity_desktop_lock_use_system_modal_dialogs) {
if (!mBusy) { if (!mBusy) {
mBusy = true; mBusy = true;
@ -1394,8 +1434,10 @@ int LockProcess::execDialog( TQDialog *dlg )
else { else {
resume( false ); resume( false );
} }
} else } else {
fakeFocusIn( mDialogs.first()->winId()); fakeFocusIn( mDialogs.first()->winId());
currentDialog = dynamic_cast<TQDialog*>(mDialogs.first());
}
return rt; return rt;
} }
@ -1437,7 +1479,10 @@ void LockProcess::slotPaintBackground()
} }
backingPixmap = pm; backingPixmap = pm;
if (trinity_desktop_lock_delay_screensaver_start && trinity_desktop_lock_forced) erase(); if (trinity_desktop_lock_delay_screensaver_start && trinity_desktop_lock_forced) {
setBackgroundPixmap(backingPixmap);
erase();
}
} }
void LockProcess::preparePopup() void LockProcess::preparePopup()
@ -1461,10 +1506,7 @@ void LockProcess::doFunctionKeyBroadcast() {
if (mkeyCode == XKeysymToKeycode(qt_xdisplay(), XF86XK_Display)) { if (mkeyCode == XKeysymToKeycode(qt_xdisplay(), XF86XK_Display)) {
while (mDialogControlLock == true) sleep(1); while (mDialogControlLock == true) sleep(1);
mDialogControlLock = true; mDialogControlLock = true;
if (currentDialog != NULL) { closeCurrentWindow();
mForceReject = true;
currentDialog->close();
}
mDialogControlLock = false; mDialogControlLock = false;
} }
setCursor( tqblankCursor ); setCursor( tqblankCursor );

@ -24,6 +24,7 @@
class KLibrary; class KLibrary;
class KWinModule; class KWinModule;
class KSMModalDialog;
struct GreeterPluginHandle { struct GreeterPluginHandle {
KLibrary *library; KLibrary *library;
@ -85,6 +86,7 @@ private slots:
void resumeUnforced(); void resumeUnforced();
void displayLockDialogIfNeeded(); void displayLockDialogIfNeeded();
void closeDialogAndStartHack(); void closeDialogAndStartHack();
bool closeCurrentWindow();
private: private:
void configure(); void configure();
@ -178,6 +180,8 @@ private:
int mHackDelayStartupTimeout; int mHackDelayStartupTimeout;
TQPixmap backingPixmap; TQPixmap backingPixmap;
KSMModalDialog* m_startupStatusDialog;
}; };
#endif #endif

Loading…
Cancel
Save