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;
@ -948,52 +966,73 @@ void LockProcess::ungrabInput()
// //
bool LockProcess::startSaver() bool LockProcess::startSaver()
{ {
if (!child_saver && !grabInput()) if (!child_saver && !grabInput())
{ {
kdWarning(1204) << "LockProcess::startSaver() grabInput() failed!!!!" << endl; kdWarning(1204) << "LockProcess::startSaver() grabInput() failed!!!!" << endl;
return false; return false;
} }
mBusy = false; mBusy = false;
saveVRoot(); // eliminate nasty flicker on first show
TQImage m_grayImage = TQImage( TQApplication::desktop()->width(), TQApplication::desktop()->height(), 32 );
if (mParent) { m_grayImage = m_grayImage.convertDepth(32);
TQSocketNotifier *notifier = new TQSocketNotifier(mParent, TQSocketNotifier::Read, TQT_TQOBJECT(this), "notifier"); m_grayImage.setAlphaBuffer(false);
connect(notifier, TQT_SIGNAL( activated (int)), TQT_SLOT( quitSaver())); m_grayImage.fill(0); // Set the alpha buffer to 0 (fully transparent)
} m_grayImage.setAlphaBuffer(true);
createSaverWindow(); TQPixmap m_root;
move(0, 0); m_root.resize( TQApplication::desktop()->geometry().width(), TQApplication::desktop()->geometry().height() );
show(); TQPainter p;
setCursor( tqblankCursor ); p.begin( &m_root );
m_grayImage.setAlphaBuffer(false);
raise(); p.drawImage( 0, 0, m_grayImage );
XSync(qt_xdisplay(), False); p.end();
setVRoot( winId(), winId() ); setBackgroundPixmap( m_root );
if (!(trinity_desktop_lock_delay_screensaver_start && trinity_desktop_lock_forced)) {
if (backingPixmap.isNull()) m_startupStatusDialog = new KSMModalDialog(this);
setBackgroundColor(black); m_startupStatusDialog->setStatusMessage(i18n("Securing desktop session").append("..."));
else m_startupStatusDialog->show();
setBackgroundPixmap(backingPixmap); m_startupStatusDialog->setActiveWindow();
erase(); tqApp->processEvents();
}
if (trinity_desktop_lock_use_system_modal_dialogs) { saveVRoot();
// Try to get the root pixmap
TQString filename = getenv("USER"); if (mParent) {
filename.prepend("/tmp/kde-"); TQSocketNotifier *notifier = new TQSocketNotifier(mParent, TQSocketNotifier::Read, TQT_TQOBJECT(this), "notifier");
filename.append("/krootbacking.png"); connect(notifier, TQT_SIGNAL( activated (int)), TQT_SLOT( quitSaver()));
remove(filename.ascii()); }
system("krootbacking &"); createSaverWindow();
TQTimer::singleShot( 0, this, SLOT(slotPaintBackground()) ); move(0, 0);
} show();
setCursor( tqblankCursor );
raise();
XSync(qt_xdisplay(), False);
setVRoot( winId(), winId() );
if (!(trinity_desktop_lock_delay_screensaver_start && trinity_desktop_lock_forced)) {
if (backingPixmap.isNull())
setBackgroundColor(black);
else
setBackgroundPixmap(backingPixmap);
erase();
}
if (trinity_desktop_lock_use_system_modal_dialogs) {
// Try to get the root pixmap
TQString filename = getenv("USER");
filename.prepend("/tmp/kde-");
filename.append("/krootbacking.png");
remove(filename.ascii());
system("krootbacking &");
TQTimer::singleShot( 0, this, SLOT(slotPaintBackground()) );
}
if (trinity_desktop_lock_delay_screensaver_start && trinity_desktop_lock_forced && trinity_desktop_lock_use_system_modal_dialogs) { if (trinity_desktop_lock_delay_screensaver_start && trinity_desktop_lock_forced && trinity_desktop_lock_use_system_modal_dialogs) {
ENABLE_CONTINUOUS_LOCKDLG_DISPLAY ENABLE_CONTINUOUS_LOCKDLG_DISPLAY
mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE); mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE);
} }
else { else {
startHack(); startHack();
} }
return true; return true;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -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