diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-09-13 02:09:39 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-09-13 02:09:39 +0000 |
commit | a278c295b0cb8ab14be821c90d9e252089547dbf (patch) | |
tree | cb7ed456080a4dd301853debc488447f210ea6f7 /kdesktop/lock | |
parent | af216eb5f2fe6491d3b5dcc2b746e1c9c3172dc5 (diff) | |
download | tdebase-a278c295b0cb8ab14be821c90d9e252089547dbf.tar.gz tdebase-a278c295b0cb8ab14be821c90d9e252089547dbf.zip |
Fix kdesktop lock process
Enable the new codepaths by default
This does change user visible behaviour, however it also repairs severe problems with the lock dialog appearing UNDER the xscreensaver hack, as well as many of the OpenGL xhacks failing.
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1253074 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdesktop/lock')
-rw-r--r-- | kdesktop/lock/lockdlg.cc | 9 | ||||
-rw-r--r-- | kdesktop/lock/lockprocess.cc | 106 | ||||
-rw-r--r-- | kdesktop/lock/lockprocess.h | 3 | ||||
-rw-r--r-- | kdesktop/lock/main.cc | 5 |
4 files changed, 92 insertions, 31 deletions
diff --git a/kdesktop/lock/lockdlg.cc b/kdesktop/lock/lockdlg.cc index 652be2a7f..95d5ab00a 100644 --- a/kdesktop/lock/lockdlg.cc +++ b/kdesktop/lock/lockdlg.cc @@ -10,6 +10,7 @@ #include "lockprocess.h" #include "lockdlg.h" +#include "kdesktopsettings.h" #include <kcheckpass.h> #include <dmctl.h> @@ -59,12 +60,14 @@ # define AF_LOCAL AF_UNIX #endif -// [FIXME] This interval should be taken from the screensaver start delay of kdesktop -#define PASSDLG_HIDE_TIMEOUT 10000 +#define PASSDLG_HIDE_TIMEOUT dialogHideTimeout extern bool trinity_desktop_lock_autohide_lockdlg; +extern bool trinity_desktop_lock_delay_screensaver_start; extern bool trinity_desktop_lock_use_system_modal_dialogs; +int dialogHideTimeout = 10*1000; + //=========================================================================== // // Simple dialog for entering a password. @@ -75,6 +78,8 @@ PasswordDlg::PasswordDlg(LockProcess *parent, GreeterPluginHandle *plugin) mCapsLocked(-1), mUnlockingFailed(false) { + dialogHideTimeout = trinity_desktop_lock_delay_screensaver_start?KDesktopSettings::timeout()*1000:10*1000; + if (trinity_desktop_lock_use_system_modal_dialogs) { // Signal that we do not want any window controls to be shown at all Atom kde_wm_system_modal_notification; diff --git a/kdesktop/lock/lockprocess.cc b/kdesktop/lock/lockprocess.cc index 02d2cf860..52ea871b2 100644 --- a/kdesktop/lock/lockprocess.cc +++ b/kdesktop/lock/lockprocess.cc @@ -177,10 +177,9 @@ LockProcess::LockProcess(bool child, bool useBlankOnly) connect( mForceContinualLockDisplayTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(displayLockDialogIfNeeded()) ); mHackDelayStartupTimer = new TQTimer( this ); - connect( mHackDelayStartupTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(startHack()) ); + connect( mHackDelayStartupTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(closeDialogAndStartHack()) ); - // [FIXME] This interval should be taken from the screensaver start delay of kdesktop - mHackDelayStartupTimeout = 10*1000; + mHackDelayStartupTimeout = trinity_desktop_lock_delay_screensaver_start?KDesktopSettings::timeout()*1000:10*1000; // Get root window size XWindowAttributes rootAttr; @@ -971,8 +970,11 @@ bool LockProcess::startSaver() XSync(qt_xdisplay(), False); setVRoot( winId(), winId() ); if (!(trinity_desktop_lock_delay_screensaver_start && trinity_desktop_lock_forced)) { - setBackgroundColor(black); - erase(); + if (backingPixmap.isNull()) + setBackgroundColor(black); + else + setBackgroundPixmap(backingPixmap); + erase(); } if (trinity_desktop_lock_use_system_modal_dialogs) { // Try to get the root pixmap @@ -984,7 +986,7 @@ bool LockProcess::startSaver() TQTimer::singleShot( 0, this, SLOT(slotPaintBackground()) ); } - if (trinity_desktop_lock_delay_screensaver_start && trinity_desktop_lock_forced) { + if (trinity_desktop_lock_delay_screensaver_start && trinity_desktop_lock_forced && trinity_desktop_lock_use_system_modal_dialogs) { ENABLE_CONTINUOUS_LOCKDLG_DISPLAY mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE); } @@ -1085,9 +1087,24 @@ bool LockProcess::startLock() //--------------------------------------------------------------------------- // +void LockProcess::closeDialogAndStartHack() +{ + // Close any active dialogs + DISABLE_CONTINUOUS_LOCKDLG_DISPLAY + mSuspended = true; + if (currentDialog != NULL) { + mForceReject = true; + currentDialog->close(); + } +} bool LockProcess::startHack() { + if (currentDialog) + { + return false; + } + if (mSaverExec.isEmpty()) { return false; @@ -1124,9 +1141,12 @@ bool LockProcess::startHack() if (!mForbidden) { - if (trinity_desktop_lock_delay_screensaver_start && trinity_desktop_lock_forced) { + if (trinity_desktop_lock_use_system_modal_dialogs) { // Make sure we have a nice clean display to start with! - setBackgroundColor(black); + if (backingPixmap.isNull()) + setBackgroundColor(black); + else + setBackgroundPixmap(backingPixmap); erase(); mSuspended = false; } @@ -1154,10 +1174,17 @@ bool LockProcess::startHack() { usleep(100); TQApplication::syncX(); - if (!trinity_desktop_lock_use_system_modal_dialogs) setBackgroundColor(black); + if (!trinity_desktop_lock_use_system_modal_dialogs) { + if (backingPixmap.isNull()) + setBackgroundColor(black); + else + setBackgroundPixmap(backingPixmap); + } if (backingPixmap.isNull()) erase(); else bitBlt(this, 0, 0, &backingPixmap); - ENABLE_CONTINUOUS_LOCKDLG_DISPLAY + if (trinity_desktop_lock_use_system_modal_dialogs) { + ENABLE_CONTINUOUS_LOCKDLG_DISPLAY + } } } return false; @@ -1185,12 +1212,19 @@ void LockProcess::hackExited(KProcess *) // Make sure the saver window is black. usleep(100); TQApplication::syncX(); - if (!trinity_desktop_lock_use_system_modal_dialogs) setBackgroundColor(black); - if (backingPixmap.isNull()) erase(); - else bitBlt(this, 0, 0, &backingPixmap); - if (!mSuspended) { - ENABLE_CONTINUOUS_LOCKDLG_DISPLAY - } + if (!trinity_desktop_lock_use_system_modal_dialogs) { + if (backingPixmap.isNull()) + setBackgroundColor(black); + else + setBackgroundPixmap(backingPixmap); + } + if (backingPixmap.isNull()) erase(); + else bitBlt(this, 0, 0, &backingPixmap); + if (!mSuspended) { + if (trinity_desktop_lock_use_system_modal_dialogs) { + ENABLE_CONTINUOUS_LOCKDLG_DISPLAY + } + } } void LockProcess::displayLockDialogIfNeeded() @@ -1216,7 +1250,6 @@ void LockProcess::suspend() if (trinity_desktop_lock_use_system_modal_dialogs) { mSuspended = true; stopHack(); - mSuspended = false; } else { TQString hackStatus; @@ -1257,11 +1290,11 @@ void LockProcess::resume( bool force ) bitBlt( this, 0, 0, &mSavedScreen ); TQApplication::syncX(); mHackProc.kill(SIGCONT); + mSuspended = false; } else if (mSuspended && trinity_desktop_lock_use_system_modal_dialogs) { startHack(); } - mSuspended = false; } //--------------------------------------------------------------------------- @@ -1473,20 +1506,39 @@ bool LockProcess::x11Event(XEvent *event) return true; // filter out // fall through case KeyPress: - if ((mHackDelayStartupTimer) && ((trinity_desktop_lock_autohide_lockdlg == FALSE) && (mHackDelayStartupTimer->isActive()))) + if ((mHackDelayStartupTimer) && (mHackDelayStartupTimer->isActive())) { mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE); + } if (mBusy || !mDialogs.isEmpty()) break; mBusy = true; - if (!mLocked || checkPass()) - { - stopSaver(); - kapp->quit(); + if (trinity_desktop_lock_delay_screensaver_start) { + if (mLocked) { + ENABLE_CONTINUOUS_LOCKDLG_DISPLAY + mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE); + } + if (!mLocked) + { + stopSaver(); + kapp->quit(); + } + if (mAutoLogout) // we need to restart the auto logout countdown + { + killTimer(mAutoLogoutTimerId); + mAutoLogoutTimerId = startTimer(mAutoLogoutTimeout); + } } - else if (mAutoLogout) // we need to restart the auto logout countdown - { - killTimer(mAutoLogoutTimerId); - mAutoLogoutTimerId = startTimer(mAutoLogoutTimeout); + else { + if (!mLocked || checkPass()) + { + stopSaver(); + kapp->quit(); + } + else if (mAutoLogout) // we need to restart the auto logout countdown + { + killTimer(mAutoLogoutTimerId); + mAutoLogoutTimerId = startTimer(mAutoLogoutTimeout); + } } mBusy = false; return true; diff --git a/kdesktop/lock/lockprocess.h b/kdesktop/lock/lockprocess.h index 2c209cc8f..ac9fdc7fa 100644 --- a/kdesktop/lock/lockprocess.h +++ b/kdesktop/lock/lockprocess.h @@ -84,7 +84,7 @@ private slots: void windowAdded( WId ); void resumeUnforced(); void displayLockDialogIfNeeded(); - bool startHack(); + void closeDialogAndStartHack(); private: void configure(); @@ -101,6 +101,7 @@ private: void cantLock(const TQString &reason); bool startSaver(); void stopSaver(); + bool startHack(); void stopHack(); void setupSignals(); void setupPipe(); diff --git a/kdesktop/lock/main.cc b/kdesktop/lock/main.cc index 14dd75384..90883f61e 100644 --- a/kdesktop/lock/main.cc +++ b/kdesktop/lock/main.cc @@ -34,7 +34,7 @@ #include <X11/Xlib.h> #include <fixx11h.h> -// [FIXME] These two settings should be user configurable! +// [FIXME] Add GUI configuration checkboxes for these two settings (see kdesktoprc [ScreenSaver] UseUnmanagedLockWindows and DelaySaverStart) bool trinity_desktop_lock_use_system_modal_dialogs = FALSE; bool trinity_desktop_lock_delay_screensaver_start = FALSE; @@ -151,6 +151,9 @@ int main( int argc, char **argv ) // we need to read from the right rc file - possibly taking screen number in account KDesktopSettings::instance("kdesktoprc"); + trinity_desktop_lock_use_system_modal_dialogs = !KDesktopSettings::useUnmanagedLockWindows(); + trinity_desktop_lock_delay_screensaver_start = KDesktopSettings::delaySaverStart(); + LockProcess process(child, args->isSet( "blank" )); if (!child) process.setChildren(child_sockets); |